From f0c6a040bd5f739de8462a1bec523181bad63d56 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 25 Jan 2019 21:14:41 +0300 Subject: remove dead code --- crates/ra_hir/src/module_tree.rs | 25 +++++-------------------- 1 file changed, 5 insertions(+), 20 deletions(-) diff --git a/crates/ra_hir/src/module_tree.rs b/crates/ra_hir/src/module_tree.rs index c00834c4c..d5ad9decb 100644 --- a/crates/ra_hir/src/module_tree.rs +++ b/crates/ra_hir/src/module_tree.rs @@ -1,6 +1,5 @@ use std::sync::Arc; -use rustc_hash::{FxHashMap, FxHashSet}; use arrayvec::ArrayVec; use relative_path::RelativePathBuf; use ra_db::{FileId, SourceRoot, CrateId}; @@ -147,28 +146,21 @@ impl ModuleTree { let file_id = crate_graph.crate_root(crate_id); let source_root_id = db.file_source_root(file_id); - let mut roots = FxHashMap::default(); - let mut visited = FxHashSet::default(); - let source_root = db.source_root(source_root_id); let source = SourceItemId { file_id: file_id.into(), item_id: None, }; - let module_id = self.init_subtree(db, &source_root, &mut visited, &mut roots, None, source); - roots.insert(file_id, module_id); + self.init_subtree(db, &source_root, None, source); } fn init_subtree( &mut self, db: &impl HirDatabase, source_root: &SourceRoot, - visited: &mut FxHashSet, - roots: &mut FxHashMap, parent: Option, source: SourceItemId, ) -> ModuleId { - visited.insert(source); let id = self.alloc_mod(ModuleData { source, parent, @@ -187,28 +179,21 @@ impl ModuleTree { let (points_to, problem) = resolve_submodule(db, source.file_id, &sub.name); let points_to = points_to .into_iter() - .map(|file_id| match roots.remove(&file_id) { - Some(module_id) => { - self.mods[module_id].parent = Some(link); - module_id - } - None => self.init_subtree( + .map(|file_id| { + self.init_subtree( db, source_root, - visited, - roots, Some(link), SourceItemId { file_id: file_id.into(), item_id: None, }, - ), + ) }) .collect::>(); (points_to, problem) } else { - let points_to = - self.init_subtree(db, source_root, visited, roots, Some(link), sub.source); + let points_to = self.init_subtree(db, source_root, Some(link), sub.source); (vec![points_to], None) }; -- cgit v1.2.3