diff options
author | Aleksey Kladov <[email protected]> | 2020-04-11 16:18:42 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2020-04-11 16:18:42 +0100 |
commit | 55356332bfd22db159fef044b9e611b5b82b417c (patch) | |
tree | c1e8ca49fb70d9cd64bd95a7b5b3a68bae484d1a | |
parent | b8eb1597c9a950a31b06d5625f2793d5237d756c (diff) |
Remove code duplication
-rw-r--r-- | crates/ra_hir_def/src/attr.rs | 1 | ||||
-rw-r--r-- | crates/ra_hir_def/src/nameres/collector.rs | 6 |
2 files changed, 2 insertions, 5 deletions
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 { | |||
93 | } | 93 | } |
94 | 94 | ||
95 | pub(crate) fn is_cfg_enabled(&self, cfg_options: &CfgOptions) -> bool { | 95 | pub(crate) fn is_cfg_enabled(&self, cfg_options: &CfgOptions) -> bool { |
96 | // FIXME: handle cfg_attr :-) | ||
96 | self.by_key("cfg").tt_values().all(|tt| cfg_options.is_cfg_enabled(tt) != Some(false)) | 97 | self.by_key("cfg").tt_values().all(|tt| cfg_options.is_cfg_enabled(tt) != Some(false)) |
97 | } | 98 | } |
98 | } | 99 | } |
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<'_, '_> { | |||
977 | } | 977 | } |
978 | 978 | ||
979 | fn is_cfg_enabled(&self, attrs: &Attrs) -> bool { | 979 | fn is_cfg_enabled(&self, attrs: &Attrs) -> bool { |
980 | // FIXME: handle cfg_attr :-) | 980 | attrs.is_cfg_enabled(self.def_collector.cfg_options) |
981 | attrs | ||
982 | .by_key("cfg") | ||
983 | .tt_values() | ||
984 | .all(|tt| self.def_collector.cfg_options.is_cfg_enabled(tt) != Some(false)) | ||
985 | } | 981 | } |
986 | } | 982 | } |
987 | 983 | ||