diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2019-12-08 11:24:44 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2019-12-08 11:24:44 +0000 |
commit | 7a6b6ed0a5311cabee9d68a89100aed46523243b (patch) | |
tree | e0a20bb1f63f0aaa9e0c335a28ccb1172e9e2c77 /crates/ra_hir/src/from_source.rs | |
parent | b236f6aa499f98985acd07a34eb0c0d147bf8d5f (diff) | |
parent | 7aacf9a19739f53a45840df2d08b5f3cca761192 (diff) |
Merge #2498
2498: Drop some unused methods r=matklad a=matklad
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_hir/src/from_source.rs')
-rw-r--r-- | crates/ra_hir/src/from_source.rs | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/crates/ra_hir/src/from_source.rs b/crates/ra_hir/src/from_source.rs index 4acc038e4..307f3d5bf 100644 --- a/crates/ra_hir/src/from_source.rs +++ b/crates/ra_hir/src/from_source.rs | |||
@@ -95,7 +95,7 @@ impl FromSource for MacroDef { | |||
95 | 95 | ||
96 | let module_src = ModuleSource::from_child_node(db, src.as_ref().map(|it| it.syntax())); | 96 | let module_src = ModuleSource::from_child_node(db, src.as_ref().map(|it| it.syntax())); |
97 | let module = Module::from_definition(db, InFile::new(src.file_id, module_src))?; | 97 | let module = Module::from_definition(db, InFile::new(src.file_id, module_src))?; |
98 | let krate = Some(module.krate().crate_id()); | 98 | let krate = Some(module.krate().id); |
99 | 99 | ||
100 | let ast_id = Some(AstId::new(src.file_id, db.ast_id_map(src.file_id).ast_id(&src.value))); | 100 | let ast_id = Some(AstId::new(src.file_id, db.ast_id_map(src.file_id).ast_id(&src.value))); |
101 | 101 | ||
@@ -216,8 +216,10 @@ impl Module { | |||
216 | } | 216 | } |
217 | }?; | 217 | }?; |
218 | 218 | ||
219 | let child_name = src.value.name()?; | 219 | let child_name = src.value.name()?.as_name(); |
220 | parent_module.child(db, &child_name.as_name()) | 220 | let def_map = db.crate_def_map(parent_module.id.krate); |
221 | let child_id = def_map[parent_module.id.local_id].children.get(&child_name)?; | ||
222 | Some(parent_module.with_module_id(*child_id)) | ||
221 | } | 223 | } |
222 | 224 | ||
223 | pub fn from_definition(db: &impl DefDatabase, src: InFile<ModuleSource>) -> Option<Self> { | 225 | pub fn from_definition(db: &impl DefDatabase, src: InFile<ModuleSource>) -> Option<Self> { |