summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Cargo.lock1
-rw-r--r--Cargo.toml1
-rw-r--r--src/ir/item.rs31
-rw-r--r--src/lib.rs15
4 files changed, 19 insertions, 29 deletions
diff --git a/Cargo.lock b/Cargo.lock
index ed6e1c88..4c453a8c 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -35,7 +35,6 @@ version = "0.55.1"
dependencies = [
"bitflags",
"cexpr",
- "cfg-if 1.0.0",
"clang-sys",
"clap",
"diff",
diff --git a/Cargo.toml b/Cargo.toml
index 3b24d3db..d06359d9 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -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(),
}
}
diff --git a/src/lib.rs b/src/lib.rs
index 7aa87831..37c301df 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -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::*;
}
};
}