From e1aa96f2c5b6cdbf0fb7f49b47209055b7a937f2 Mon Sep 17 00:00:00 2001 From: Kirill Bulatov Date: Mon, 9 Mar 2020 11:26:46 +0200 Subject: Less abstract CrateData api --- crates/ra_hir_def/src/nameres/collector.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'crates/ra_hir_def/src/nameres') diff --git a/crates/ra_hir_def/src/nameres/collector.rs b/crates/ra_hir_def/src/nameres/collector.rs index 51c65a5d7..e69f89b80 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 let crate_graph = db.crate_graph(); // populate external prelude - for dep in crate_graph.dependencies(def_map.krate) { + for dep in &crate_graph.crate_data(&def_map.krate).dependencies { let dep_def_map = db.crate_def_map(dep.crate_id); log::debug!("crate dep {:?} -> {:?}", dep.name, dep.crate_id); def_map.extern_prelude.insert( @@ -128,8 +128,7 @@ where DB: DefDatabase, { fn collect(&mut self) { - let crate_graph = self.db.crate_graph(); - let file_id = crate_graph.crate_root(self.def_map.krate); + let file_id = self.db.crate_graph().crate_data(&self.def_map.krate).root_file_id; let raw_items = self.db.raw_items(file_id.into()); let module_id = self.def_map.root; self.def_map.modules[module_id].origin = ModuleOrigin::CrateRoot { definition: file_id }; @@ -955,7 +954,7 @@ mod tests { let krate = db.test_crate(); let def_map = { - let edition = db.crate_graph().edition(krate); + let edition = db.crate_graph().crate_data(&krate).edition; let mut modules: Arena = Arena::default(); let root = modules.alloc(ModuleData::default()); CrateDefMap { -- cgit v1.2.3