mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-28 14:03:35 +00:00
Remove code duplication
This commit is contained in:
parent
b8eb1597c9
commit
55356332bf
2 changed files with 2 additions and 5 deletions
|
@ -93,6 +93,7 @@ impl Attrs {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn is_cfg_enabled(&self, cfg_options: &CfgOptions) -> bool {
|
pub(crate) fn is_cfg_enabled(&self, cfg_options: &CfgOptions) -> bool {
|
||||||
|
// FIXME: handle cfg_attr :-)
|
||||||
self.by_key("cfg").tt_values().all(|tt| cfg_options.is_cfg_enabled(tt) != Some(false))
|
self.by_key("cfg").tt_values().all(|tt| cfg_options.is_cfg_enabled(tt) != Some(false))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -977,11 +977,7 @@ impl ModCollector<'_, '_> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn is_cfg_enabled(&self, attrs: &Attrs) -> bool {
|
fn is_cfg_enabled(&self, attrs: &Attrs) -> bool {
|
||||||
// FIXME: handle cfg_attr :-)
|
attrs.is_cfg_enabled(self.def_collector.cfg_options)
|
||||||
attrs
|
|
||||||
.by_key("cfg")
|
|
||||||
.tt_values()
|
|
||||||
.all(|tt| self.def_collector.cfg_options.is_cfg_enabled(tt) != Some(false))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue