Skip to content

Commit 30fb4ec

Browse files
committed
Remove cfg-if dependency.
We use it so little that it's not worth it.
1 parent 01cbe44 commit 30fb4ec

File tree

4 files changed

+19
-29
lines changed

4 files changed

+19
-29
lines changed

Cargo.lock

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ shlex = "0.1"
4747
[dependencies]
4848
bitflags = "1.0.3"
4949
cexpr = "0.4"
50-
cfg-if = "1"
5150
# This kinda sucks: https://github.com/rust-lang/cargo/issues/1982
5251
clap = { version = "2", optional = true }
5352
clang-sys = { version = "1", features = ["clang_6_0"] }

src/ir/item.rs

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -101,24 +101,23 @@ pub trait ItemAncestors {
101101
fn ancestors<'a>(&self, ctx: &'a BindgenContext) -> ItemAncestorsIter<'a>;
102102
}
103103

104-
cfg_if! {
105-
if #[cfg(testing_only_extra_assertions)] {
106-
type DebugOnlyItemSet = ItemSet;
107-
} else {
108-
struct DebugOnlyItemSet;
109-
110-
impl DebugOnlyItemSet {
111-
fn new() -> Self {
112-
DebugOnlyItemSet
113-
}
104+
#[cfg(testing_only_extra_assertions)]
105+
type DebugOnlyItemSet = ItemSet;
114106

115-
fn contains(&self, _id: &ItemId) -> bool {
116-
false
117-
}
107+
#[cfg(not(testing_only_extra_assertions))]
108+
struct DebugOnlyItemSet;
118109

119-
fn insert(&mut self, _id: ItemId) {}
120-
}
110+
#[cfg(not(testing_only_extra_assertions))]
111+
impl DebugOnlyItemSet {
112+
fn new() -> Self {
113+
DebugOnlyItemSet
121114
}
115+
116+
fn contains(&self, _id: &ItemId) -> bool {
117+
false
118+
}
119+
120+
fn insert(&mut self, _id: ItemId) {}
122121
}
123122

124123
/// An iterator over an item and its ancestors.
@@ -132,7 +131,7 @@ impl<'a> ItemAncestorsIter<'a> {
132131
fn new<Id: Into<ItemId>>(ctx: &'a BindgenContext, id: Id) -> Self {
133132
ItemAncestorsIter {
134133
item: id.into(),
135-
ctx: ctx,
134+
ctx,
136135
seen: DebugOnlyItemSet::new(),
137136
}
138137
}

src/lib.rs

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,6 @@
1818
#[macro_use]
1919
extern crate bitflags;
2020
#[macro_use]
21-
#[allow(unused_extern_crates)]
22-
extern crate cfg_if;
23-
#[macro_use]
2421
extern crate lazy_static;
2522
#[macro_use]
2623
extern crate quote;
@@ -44,14 +41,10 @@ mod extra_assertions;
4441
// we don't expose internals to library consumers.
4542
macro_rules! doc_mod {
4643
($m:ident, $doc_mod_name:ident) => {
47-
cfg_if! {
48-
if #[cfg(feature = "testing_only_docs")] {
49-
pub mod $doc_mod_name {
50-
//! Autogenerated documentation module.
51-
pub use super::$m::*;
52-
}
53-
} else {
54-
}
44+
#[cfg(feature = "testing_only_docs")]
45+
pub mod $doc_mod_name {
46+
//! Autogenerated documentation module.
47+
pub use super::$m::*;
5548
}
5649
};
5750
}

0 commit comments

Comments
 (0)