diff options
Diffstat (limited to 'crates/ra_analysis/src/module_map.rs')
-rw-r--r-- | crates/ra_analysis/src/module_map.rs | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/crates/ra_analysis/src/module_map.rs b/crates/ra_analysis/src/module_map.rs index c1799e3d4..ff0ec3cc7 100644 --- a/crates/ra_analysis/src/module_map.rs +++ b/crates/ra_analysis/src/module_map.rs | |||
@@ -1,10 +1,11 @@ | |||
1 | use std::sync::Arc; | ||
2 | use crate::{ | 1 | use crate::{ |
3 | FileId, | 2 | db::SyntaxDatabase, |
4 | db::{SyntaxDatabase}, | ||
5 | descriptors::{ModuleDescriptor, ModuleTreeDescriptor}, | 3 | descriptors::{ModuleDescriptor, ModuleTreeDescriptor}, |
4 | FileId, | ||
6 | }; | 5 | }; |
7 | 6 | ||
7 | use std::sync::Arc; | ||
8 | |||
8 | salsa::query_group! { | 9 | salsa::query_group! { |
9 | pub(crate) trait ModulesDatabase: SyntaxDatabase { | 10 | pub(crate) trait ModulesDatabase: SyntaxDatabase { |
10 | fn module_tree(key: ()) -> Arc<ModuleTreeDescriptor> { | 11 | fn module_tree(key: ()) -> Arc<ModuleTreeDescriptor> { |
@@ -16,7 +17,6 @@ salsa::query_group! { | |||
16 | } | 17 | } |
17 | } | 18 | } |
18 | 19 | ||
19 | |||
20 | fn module_descriptor(db: &impl ModulesDatabase, file_id: FileId) -> Arc<ModuleDescriptor> { | 20 | fn module_descriptor(db: &impl ModulesDatabase, file_id: FileId) -> Arc<ModuleDescriptor> { |
21 | let file = db.file_syntax(file_id); | 21 | let file = db.file_syntax(file_id); |
22 | Arc::new(ModuleDescriptor::new(file.ast())) | 22 | Arc::new(ModuleDescriptor::new(file.ast())) |
@@ -29,6 +29,9 @@ fn module_tree(db: &impl ModulesDatabase, (): ()) -> Arc<ModuleTreeDescriptor> { | |||
29 | let module_descr = db.module_descriptor(file_id); | 29 | let module_descr = db.module_descriptor(file_id); |
30 | files.push((file_id, module_descr)); | 30 | files.push((file_id, module_descr)); |
31 | } | 31 | } |
32 | let res = ModuleTreeDescriptor::new(files.iter().map(|(file_id, descr)| (*file_id, &**descr)), &file_set.resolver); | 32 | let res = ModuleTreeDescriptor::new( |
33 | files.iter().map(|(file_id, descr)| (*file_id, &**descr)), | ||
34 | &file_set.resolver, | ||
35 | ); | ||
33 | Arc::new(res) | 36 | Arc::new(res) |
34 | } | 37 | } |