Remove code duplication

This commit is contained in:
Aleksey Kladov 2020-04-11 17:18:42 +02:00
parent b8eb1597c9
commit 55356332bf
2 changed files with 2 additions and 5 deletions

View file

@ -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))
} }
} }

View file

@ -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))
} }
} }