From abf2179c0b606730acadc61451739baecfa33a5d Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 14 Oct 2019 16:20:55 +0300 Subject: Prepare SourceDatabase API for lazy file loading --- crates/ra_hir/src/from_source.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'crates/ra_hir/src/from_source.rs') diff --git a/crates/ra_hir/src/from_source.rs b/crates/ra_hir/src/from_source.rs index a012f33f7..f80d8eb5f 100644 --- a/crates/ra_hir/src/from_source.rs +++ b/crates/ra_hir/src/from_source.rs @@ -189,14 +189,14 @@ impl Module { ModuleSource::SourceFile(_) => None, }; - let source_root_id = db.file_source_root(src.file_id.original_file(db)); - db.source_root_crates(source_root_id).iter().map(|&crate_id| Crate { crate_id }).find_map( - |krate| { + db.relevant_crates(src.file_id.original_file(db)) + .iter() + .map(|&crate_id| Crate { crate_id }) + .find_map(|krate| { let def_map = db.crate_def_map(krate); let module_id = def_map.find_module_by_source(src.file_id, decl_id)?; Some(Module { krate, module_id }) - }, - ) + }) } } -- cgit v1.2.3