From a300fb68e25ea0cbf2cfba38968a40674cd4c805 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 20 Nov 2018 17:16:33 +0300 Subject: Make most of modules impl private --- crates/ra_analysis/src/imp.rs | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'crates/ra_analysis/src/imp.rs') diff --git a/crates/ra_analysis/src/imp.rs b/crates/ra_analysis/src/imp.rs index 1bbf0cb6d..61296215c 100644 --- a/crates/ra_analysis/src/imp.rs +++ b/crates/ra_analysis/src/imp.rs @@ -21,7 +21,7 @@ use crate::{ db::{self, FileSyntaxQuery, SyntaxDatabase}, descriptors::{ function::{FnDescriptor, FnId}, - module::{ModuleDescriptor, ModuleSource, ModuleTree, Problem}, + module::{ModuleDescriptor, Problem}, DeclarationDescriptor, DescriptorDatabase, }, input::{FilesDatabase, SourceRoot, SourceRootId, WORKSPACE}, @@ -216,10 +216,6 @@ impl AnalysisImpl { .sweep(salsa::SweepStrategy::default().discard_values()); Ok(query.search(&buf)) } - fn module_tree(&self, file_id: FileId) -> Cancelable> { - let source_root = self.db.file_source_root(file_id); - self.db.module_tree(source_root) - } /// This return `Vec`: a module may be inclucded from several places. /// We don't handle this case yet though, so the Vec has length at most one. pub fn parent_module(&self, position: FilePosition) -> Cancelable> { @@ -354,7 +350,6 @@ impl AnalysisImpl { } pub fn diagnostics(&self, file_id: FileId) -> Cancelable> { - let module_tree = self.module_tree(file_id)?; let syntax = self.db.file_syntax(file_id); let mut res = ra_editor::diagnostics(&syntax) @@ -365,8 +360,8 @@ impl AnalysisImpl { fix: None, }) .collect::>(); - if let Some(m) = module_tree.any_module_for_source(ModuleSource::SourceFile(file_id)) { - for (name_node, problem) in m.problems(&module_tree, &*self.db) { + if let Some(m) = ModuleDescriptor::guess_from_file_id(&*self.db, file_id)? { + for (name_node, problem) in m.problems(&*self.db) { let diag = match problem { Problem::UnresolvedModule { candidate } => { let create_file = FileSystemEdit::CreateFile { -- cgit v1.2.3