diff options
-rw-r--r-- | Cargo.lock | 1 | ||||
-rw-r--r-- | Cargo.toml | 1 | ||||
-rw-r--r-- | src/ir/item.rs | 31 | ||||
-rw-r--r-- | src/lib.rs | 15 |
4 files changed, 19 insertions, 29 deletions
@@ -35,7 +35,6 @@ version = "0.55.1" dependencies = [ "bitflags", "cexpr", - "cfg-if 1.0.0", "clang-sys", "clap", "diff", @@ -47,7 +47,6 @@ shlex = "0.1" [dependencies] bitflags = "1.0.3" cexpr = "0.4" -cfg-if = "1" # This kinda sucks: https://github.com/rust-lang/cargo/issues/1982 clap = { version = "2", optional = true } clang-sys = { version = "1", features = ["clang_6_0"] } diff --git a/src/ir/item.rs b/src/ir/item.rs index f9da64fd..e9abed70 100644 --- a/src/ir/item.rs +++ b/src/ir/item.rs @@ -101,24 +101,23 @@ pub trait ItemAncestors { fn ancestors<'a>(&self, ctx: &'a BindgenContext) -> ItemAncestorsIter<'a>; } -cfg_if! { - if #[cfg(testing_only_extra_assertions)] { - type DebugOnlyItemSet = ItemSet; - } else { - struct DebugOnlyItemSet; - - impl DebugOnlyItemSet { - fn new() -> Self { - DebugOnlyItemSet - } +#[cfg(testing_only_extra_assertions)] +type DebugOnlyItemSet = ItemSet; - fn contains(&self, _id: &ItemId) -> bool { - false - } +#[cfg(not(testing_only_extra_assertions))] +struct DebugOnlyItemSet; - fn insert(&mut self, _id: ItemId) {} - } +#[cfg(not(testing_only_extra_assertions))] +impl DebugOnlyItemSet { + fn new() -> Self { + DebugOnlyItemSet } + + fn contains(&self, _id: &ItemId) -> bool { + false + } + + fn insert(&mut self, _id: ItemId) {} } /// An iterator over an item and its ancestors. @@ -132,7 +131,7 @@ impl<'a> ItemAncestorsIter<'a> { fn new<Id: Into<ItemId>>(ctx: &'a BindgenContext, id: Id) -> Self { ItemAncestorsIter { item: id.into(), - ctx: ctx, + ctx, seen: DebugOnlyItemSet::new(), } } @@ -18,9 +18,6 @@ #[macro_use] extern crate bitflags; #[macro_use] -#[allow(unused_extern_crates)] -extern crate cfg_if; -#[macro_use] extern crate lazy_static; #[macro_use] extern crate quote; @@ -44,14 +41,10 @@ mod extra_assertions; // we don't expose internals to library consumers. macro_rules! doc_mod { ($m:ident, $doc_mod_name:ident) => { - cfg_if! { - if #[cfg(feature = "testing_only_docs")] { - pub mod $doc_mod_name { - //! Autogenerated documentation module. - pub use super::$m::*; - } - } else { - } + #[cfg(feature = "testing_only_docs")] + pub mod $doc_mod_name { + //! Autogenerated documentation module. + pub use super::$m::*; } }; } |