diff options
Diffstat (limited to 'crates/ra_hir_def/src/nameres')
-rw-r--r-- | crates/ra_hir_def/src/nameres/collector.rs | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/crates/ra_hir_def/src/nameres/collector.rs b/crates/ra_hir_def/src/nameres/collector.rs index 7b2487999..15941a1cb 100644 --- a/crates/ra_hir_def/src/nameres/collector.rs +++ b/crates/ra_hir_def/src/nameres/collector.rs | |||
@@ -7,7 +7,7 @@ use hir_expand::{ | |||
7 | }; | 7 | }; |
8 | use ra_cfg::CfgOptions; | 8 | use ra_cfg::CfgOptions; |
9 | use ra_db::{CrateId, FileId}; | 9 | use ra_db::{CrateId, FileId}; |
10 | use ra_syntax::{ast, SmolStr}; | 10 | use ra_syntax::ast; |
11 | use rustc_hash::{FxHashMap, FxHashSet}; | 11 | use rustc_hash::{FxHashMap, FxHashSet}; |
12 | use test_utils::tested_by; | 12 | use test_utils::tested_by; |
13 | 13 | ||
@@ -599,7 +599,7 @@ where | |||
599 | } | 599 | } |
600 | 600 | ||
601 | fn collect_module(&mut self, module: &raw::ModuleData, attrs: &Attrs) { | 601 | fn collect_module(&mut self, module: &raw::ModuleData, attrs: &Attrs) { |
602 | let path_attr = self.path_attr(attrs); | 602 | let path_attr = attrs.find_string_value("path"); |
603 | let is_macro_use = attrs.has_atom("macro_use"); | 603 | let is_macro_use = attrs.has_atom("macro_use"); |
604 | match module { | 604 | match module { |
605 | // inline module, just recurse | 605 | // inline module, just recurse |
@@ -612,7 +612,7 @@ where | |||
612 | module_id, | 612 | module_id, |
613 | file_id: self.file_id, | 613 | file_id: self.file_id, |
614 | raw_items: self.raw_items, | 614 | raw_items: self.raw_items, |
615 | mod_dir: self.mod_dir.descend_into_definition(name, path_attr), | 615 | mod_dir: self.mod_dir.descend_into_definition(name, path_attr.as_ref()), |
616 | } | 616 | } |
617 | .collect(&*items); | 617 | .collect(&*items); |
618 | if is_macro_use { | 618 | if is_macro_use { |
@@ -626,7 +626,7 @@ where | |||
626 | self.def_collector.db, | 626 | self.def_collector.db, |
627 | self.file_id, | 627 | self.file_id, |
628 | name, | 628 | name, |
629 | path_attr, | 629 | path_attr.as_ref(), |
630 | ) { | 630 | ) { |
631 | Ok((file_id, mod_dir)) => { | 631 | Ok((file_id, mod_dir)) => { |
632 | let module_id = self.push_child_module(name.clone(), ast_id, Some(file_id)); | 632 | let module_id = self.push_child_module(name.clone(), ast_id, Some(file_id)); |
@@ -798,10 +798,6 @@ where | |||
798 | fn is_cfg_enabled(&self, attrs: &Attrs) -> bool { | 798 | fn is_cfg_enabled(&self, attrs: &Attrs) -> bool { |
799 | attrs.iter().all(|attr| attr.is_cfg_enabled(&self.def_collector.cfg_options) != Some(false)) | 799 | attrs.iter().all(|attr| attr.is_cfg_enabled(&self.def_collector.cfg_options) != Some(false)) |
800 | } | 800 | } |
801 | |||
802 | fn path_attr<'a>(&self, attrs: &'a Attrs) -> Option<&'a SmolStr> { | ||
803 | attrs.iter().find_map(|attr| attr.as_path()) | ||
804 | } | ||
805 | } | 801 | } |
806 | 802 | ||
807 | fn is_macro_rules(path: &Path) -> bool { | 803 | fn is_macro_rules(path: &Path) -> bool { |