diff options
author | Aleksey Kladov <[email protected]> | 2020-03-09 10:11:59 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2020-03-09 10:11:59 +0000 |
commit | 0320ebdd101b01abe5f24e9efcef7c15005fd3a5 (patch) | |
tree | 37d5176dfabe886b1eadb2ddb16fbb6834df0a16 /crates/ra_hir_def/src/nameres | |
parent | 57c27f91392fdd9d72fd023f4e2fecd8b68a7d09 (diff) |
Use `Index` for CrateGraph
Diffstat (limited to 'crates/ra_hir_def/src/nameres')
-rw-r--r-- | crates/ra_hir_def/src/nameres/collector.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/crates/ra_hir_def/src/nameres/collector.rs b/crates/ra_hir_def/src/nameres/collector.rs index e69f89b80..bfa3db47a 100644 --- a/crates/ra_hir_def/src/nameres/collector.rs +++ b/crates/ra_hir_def/src/nameres/collector.rs | |||
@@ -34,7 +34,7 @@ pub(super) fn collect_defs(db: &impl DefDatabase, mut def_map: CrateDefMap) -> C | |||
34 | let crate_graph = db.crate_graph(); | 34 | let crate_graph = db.crate_graph(); |
35 | 35 | ||
36 | // populate external prelude | 36 | // populate external prelude |
37 | for dep in &crate_graph.crate_data(&def_map.krate).dependencies { | 37 | for dep in &crate_graph[def_map.krate].dependencies { |
38 | let dep_def_map = db.crate_def_map(dep.crate_id); | 38 | let dep_def_map = db.crate_def_map(dep.crate_id); |
39 | log::debug!("crate dep {:?} -> {:?}", dep.name, dep.crate_id); | 39 | log::debug!("crate dep {:?} -> {:?}", dep.name, dep.crate_id); |
40 | def_map.extern_prelude.insert( | 40 | def_map.extern_prelude.insert( |
@@ -128,7 +128,7 @@ where | |||
128 | DB: DefDatabase, | 128 | DB: DefDatabase, |
129 | { | 129 | { |
130 | fn collect(&mut self) { | 130 | fn collect(&mut self) { |
131 | let file_id = self.db.crate_graph().crate_data(&self.def_map.krate).root_file_id; | 131 | let file_id = self.db.crate_graph()[self.def_map.krate].root_file_id; |
132 | let raw_items = self.db.raw_items(file_id.into()); | 132 | let raw_items = self.db.raw_items(file_id.into()); |
133 | let module_id = self.def_map.root; | 133 | let module_id = self.def_map.root; |
134 | self.def_map.modules[module_id].origin = ModuleOrigin::CrateRoot { definition: file_id }; | 134 | self.def_map.modules[module_id].origin = ModuleOrigin::CrateRoot { definition: file_id }; |
@@ -954,7 +954,7 @@ mod tests { | |||
954 | let krate = db.test_crate(); | 954 | let krate = db.test_crate(); |
955 | 955 | ||
956 | let def_map = { | 956 | let def_map = { |
957 | let edition = db.crate_graph().crate_data(&krate).edition; | 957 | let edition = db.crate_graph()[krate].edition; |
958 | let mut modules: Arena<LocalModuleId, ModuleData> = Arena::default(); | 958 | let mut modules: Arena<LocalModuleId, ModuleData> = Arena::default(); |
959 | let root = modules.alloc(ModuleData::default()); | 959 | let root = modules.alloc(ModuleData::default()); |
960 | CrateDefMap { | 960 | CrateDefMap { |