diff options
author | uHOOCCOOHu <[email protected]> | 2019-09-30 10:47:17 +0100 |
---|---|---|
committer | uHOOCCOOHu <[email protected]> | 2019-10-02 19:28:02 +0100 |
commit | a49ad47e5afa5950f92b77badc6679295101328a (patch) | |
tree | dfb48fb37c1db1ecbcfb7bf75f5acf0f9023d29d /crates/ra_hir/src/nameres | |
parent | d2ea776b8fbb5286a04dde75a9a8f8b14f12bfe9 (diff) |
Support cfg attribute on impl blocks
Diffstat (limited to 'crates/ra_hir/src/nameres')
-rw-r--r-- | crates/ra_hir/src/nameres/collector.rs | 5 | ||||
-rw-r--r-- | crates/ra_hir/src/nameres/raw.rs | 4 |
2 files changed, 2 insertions, 7 deletions
diff --git a/crates/ra_hir/src/nameres/collector.rs b/crates/ra_hir/src/nameres/collector.rs index f0e790e4c..1d79cbd8c 100644 --- a/crates/ra_hir/src/nameres/collector.rs +++ b/crates/ra_hir/src/nameres/collector.rs | |||
@@ -716,10 +716,7 @@ where | |||
716 | } | 716 | } |
717 | 717 | ||
718 | fn is_cfg_enabled(&self, attrs: &[Attr]) -> bool { | 718 | fn is_cfg_enabled(&self, attrs: &[Attr]) -> bool { |
719 | attrs | 719 | attrs.iter().all(|attr| attr.is_cfg_enabled(&self.def_collector.cfg_options) != Some(false)) |
720 | .iter() | ||
721 | .flat_map(|attr| attr.as_cfg()) | ||
722 | .all(|cfg| self.def_collector.cfg_options.is_cfg_enabled(cfg).unwrap_or(true)) | ||
723 | } | 720 | } |
724 | } | 721 | } |
725 | 722 | ||
diff --git a/crates/ra_hir/src/nameres/raw.rs b/crates/ra_hir/src/nameres/raw.rs index ff079bcf1..f02d4eb7a 100644 --- a/crates/ra_hir/src/nameres/raw.rs +++ b/crates/ra_hir/src/nameres/raw.rs | |||
@@ -411,9 +411,7 @@ impl<DB: AstDatabase> RawItemsCollector<&DB> { | |||
411 | } | 411 | } |
412 | 412 | ||
413 | fn parse_attrs(&self, item: &impl ast::AttrsOwner) -> Arc<[Attr]> { | 413 | fn parse_attrs(&self, item: &impl ast::AttrsOwner) -> Arc<[Attr]> { |
414 | item.attrs() | 414 | Attr::from_attrs_owner(self.file_id, item, self.db) |
415 | .flat_map(|ast| Attr::from_src(Source { ast, file_id: self.file_id }, self.db)) | ||
416 | .collect() | ||
417 | } | 415 | } |
418 | } | 416 | } |
419 | 417 | ||