From 55356332bfd22db159fef044b9e611b5b82b417c Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sat, 11 Apr 2020 17:18:42 +0200 Subject: Remove code duplication --- crates/ra_hir_def/src/attr.rs | 1 + crates/ra_hir_def/src/nameres/collector.rs | 6 +----- 2 files changed, 2 insertions(+), 5 deletions(-) (limited to 'crates/ra_hir_def') diff --git a/crates/ra_hir_def/src/attr.rs b/crates/ra_hir_def/src/attr.rs index 7b0c506b1..2f2e3e5ba 100644 --- a/crates/ra_hir_def/src/attr.rs +++ b/crates/ra_hir_def/src/attr.rs @@ -93,6 +93,7 @@ impl Attrs { } 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)) } } diff --git a/crates/ra_hir_def/src/nameres/collector.rs b/crates/ra_hir_def/src/nameres/collector.rs index 8fe3f8617..1c33a6520 100644 --- a/crates/ra_hir_def/src/nameres/collector.rs +++ b/crates/ra_hir_def/src/nameres/collector.rs @@ -977,11 +977,7 @@ impl ModCollector<'_, '_> { } fn is_cfg_enabled(&self, attrs: &Attrs) -> bool { - // FIXME: handle cfg_attr :-) - attrs - .by_key("cfg") - .tt_values() - .all(|tt| self.def_collector.cfg_options.is_cfg_enabled(tt) != Some(false)) + attrs.is_cfg_enabled(self.def_collector.cfg_options) } } -- cgit v1.2.3