aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_analysis
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_analysis')
-rw-r--r--crates/ra_analysis/src/hir/db.rs14
-rw-r--r--crates/ra_analysis/src/hir/function/imp.rs2
-rw-r--r--crates/ra_analysis/src/hir/module/imp.rs2
-rw-r--r--crates/ra_analysis/src/hir/module/mod.rs6
-rw-r--r--crates/ra_analysis/src/hir/module/nameres.rs20
5 files changed, 22 insertions, 22 deletions
diff --git a/crates/ra_analysis/src/hir/db.rs b/crates/ra_analysis/src/hir/db.rs
index 3cdf8e6d6..498a5c2dd 100644
--- a/crates/ra_analysis/src/hir/db.rs
+++ b/crates/ra_analysis/src/hir/db.rs
@@ -25,37 +25,37 @@ pub(crate) trait HirDatabase: SyntaxDatabase + IdDatabase {
25 use fn crate::hir::function::imp::fn_scopes; 25 use fn crate::hir::function::imp::fn_scopes;
26 } 26 }
27 27
28 fn _file_items(file_id: FileId) -> Arc<FileItems> { 28 fn file_items(file_id: FileId) -> Arc<FileItems> {
29 type FileItemsQuery; 29 type FileItemsQuery;
30 storage dependencies; 30 storage dependencies;
31 use fn crate::hir::module::nameres::file_items; 31 use fn crate::hir::module::nameres::file_items;
32 } 32 }
33 33
34 fn _file_item(file_id: FileId, file_item_id: FileItemId) -> SyntaxNode { 34 fn file_item(file_id: FileId, file_item_id: FileItemId) -> SyntaxNode {
35 type FileItemQuery; 35 type FileItemQuery;
36 storage dependencies; 36 storage dependencies;
37 use fn crate::hir::module::nameres::file_item; 37 use fn crate::hir::module::nameres::file_item;
38 } 38 }
39 39
40 fn _input_module_items(source_root_id: SourceRootId, module_id: ModuleId) -> Cancelable<Arc<InputModuleItems>> { 40 fn input_module_items(source_root_id: SourceRootId, module_id: ModuleId) -> Cancelable<Arc<InputModuleItems>> {
41 type InputModuleItemsQuery; 41 type InputModuleItemsQuery;
42 use fn crate::hir::module::nameres::input_module_items; 42 use fn crate::hir::module::nameres::input_module_items;
43 } 43 }
44 fn _item_map(source_root_id: SourceRootId) -> Cancelable<Arc<ItemMap>> { 44 fn item_map(source_root_id: SourceRootId) -> Cancelable<Arc<ItemMap>> {
45 type ItemMapQuery; 45 type ItemMapQuery;
46 use fn crate::hir::module::nameres::item_map; 46 use fn crate::hir::module::nameres::item_map;
47 } 47 }
48 fn _module_tree(source_root_id: SourceRootId) -> Cancelable<Arc<ModuleTree>> { 48 fn module_tree(source_root_id: SourceRootId) -> Cancelable<Arc<ModuleTree>> {
49 type ModuleTreeQuery; 49 type ModuleTreeQuery;
50 use fn crate::hir::module::imp::module_tree; 50 use fn crate::hir::module::imp::module_tree;
51 } 51 }
52 fn _fn_syntax(fn_id: FnId) -> FnDefNode { 52 fn fn_syntax(fn_id: FnId) -> FnDefNode {
53 type FnSyntaxQuery; 53 type FnSyntaxQuery;
54 // Don't retain syntax trees in memory 54 // Don't retain syntax trees in memory
55 storage dependencies; 55 storage dependencies;
56 use fn crate::hir::function::imp::fn_syntax; 56 use fn crate::hir::function::imp::fn_syntax;
57 } 57 }
58 fn _submodules(source: ModuleSource) -> Cancelable<Arc<Vec<crate::hir::module::imp::Submodule>>> { 58 fn submodules(source: ModuleSource) -> Cancelable<Arc<Vec<crate::hir::module::imp::Submodule>>> {
59 type SubmodulesQuery; 59 type SubmodulesQuery;
60 use fn crate::hir::module::imp::submodules; 60 use fn crate::hir::module::imp::submodules;
61 } 61 }
diff --git a/crates/ra_analysis/src/hir/function/imp.rs b/crates/ra_analysis/src/hir/function/imp.rs
index 0d487d024..5f5f68ac5 100644
--- a/crates/ra_analysis/src/hir/function/imp.rs
+++ b/crates/ra_analysis/src/hir/function/imp.rs
@@ -15,7 +15,7 @@ pub(crate) fn fn_syntax(db: &impl HirDatabase, fn_id: FnId) -> FnDefNode {
15} 15}
16 16
17pub(crate) fn fn_scopes(db: &impl HirDatabase, fn_id: FnId) -> Arc<FnScopes> { 17pub(crate) fn fn_scopes(db: &impl HirDatabase, fn_id: FnId) -> Arc<FnScopes> {
18 let syntax = db._fn_syntax(fn_id); 18 let syntax = db.fn_syntax(fn_id);
19 let res = FnScopes::new(syntax.borrowed()); 19 let res = FnScopes::new(syntax.borrowed());
20 Arc::new(res) 20 Arc::new(res)
21} 21}
diff --git a/crates/ra_analysis/src/hir/module/imp.rs b/crates/ra_analysis/src/hir/module/imp.rs
index 062457ae0..f9853584e 100644
--- a/crates/ra_analysis/src/hir/module/imp.rs
+++ b/crates/ra_analysis/src/hir/module/imp.rs
@@ -135,7 +135,7 @@ fn build_subtree(
135 parent, 135 parent,
136 children: Vec::new(), 136 children: Vec::new(),
137 }); 137 });
138 for sub in db._submodules(source)?.iter() { 138 for sub in db.submodules(source)?.iter() {
139 let link = tree.push_link(LinkData { 139 let link = tree.push_link(LinkData {
140 name: sub.name().clone(), 140 name: sub.name().clone(),
141 owner: id, 141 owner: id,
diff --git a/crates/ra_analysis/src/hir/module/mod.rs b/crates/ra_analysis/src/hir/module/mod.rs
index 5bff11c90..55b6639be 100644
--- a/crates/ra_analysis/src/hir/module/mod.rs
+++ b/crates/ra_analysis/src/hir/module/mod.rs
@@ -64,7 +64,7 @@ impl ModuleDescriptor {
64 module_source: ModuleSource, 64 module_source: ModuleSource,
65 ) -> Cancelable<Option<ModuleDescriptor>> { 65 ) -> Cancelable<Option<ModuleDescriptor>> {
66 let source_root_id = db.file_source_root(file_id); 66 let source_root_id = db.file_source_root(file_id);
67 let module_tree = db._module_tree(source_root_id)?; 67 let module_tree = db.module_tree(source_root_id)?;
68 68
69 let res = match module_tree.any_module_for_source(module_source) { 69 let res = match module_tree.any_module_for_source(module_source) {
70 None => None, 70 None => None,
@@ -82,7 +82,7 @@ impl ModuleDescriptor {
82 source_root_id: SourceRootId, 82 source_root_id: SourceRootId,
83 module_id: ModuleId, 83 module_id: ModuleId,
84 ) -> Cancelable<ModuleDescriptor> { 84 ) -> Cancelable<ModuleDescriptor> {
85 let module_tree = db._module_tree(source_root_id)?; 85 let module_tree = db.module_tree(source_root_id)?;
86 let res = ModuleDescriptor { 86 let res = ModuleDescriptor {
87 tree: module_tree, 87 tree: module_tree,
88 source_root_id, 88 source_root_id,
@@ -148,7 +148,7 @@ impl ModuleDescriptor {
148 148
149 /// Returns a `ModuleScope`: a set of items, visible in this module. 149 /// Returns a `ModuleScope`: a set of items, visible in this module.
150 pub(crate) fn scope(&self, db: &impl HirDatabase) -> Cancelable<ModuleScope> { 150 pub(crate) fn scope(&self, db: &impl HirDatabase) -> Cancelable<ModuleScope> {
151 let item_map = db._item_map(self.source_root_id)?; 151 let item_map = db.item_map(self.source_root_id)?;
152 let res = item_map.per_module[&self.module_id].clone(); 152 let res = item_map.per_module[&self.module_id].clone();
153 Ok(res) 153 Ok(res)
154 } 154 }
diff --git a/crates/ra_analysis/src/hir/module/nameres.rs b/crates/ra_analysis/src/hir/module/nameres.rs
index bb5a888c8..eaf9f9373 100644
--- a/crates/ra_analysis/src/hir/module/nameres.rs
+++ b/crates/ra_analysis/src/hir/module/nameres.rs
@@ -91,7 +91,7 @@ pub(crate) fn file_item(
91 file_id: FileId, 91 file_id: FileId,
92 file_item_id: FileItemId, 92 file_item_id: FileItemId,
93) -> SyntaxNode { 93) -> SyntaxNode {
94 db._file_items(file_id)[file_item_id].clone() 94 db.file_items(file_id)[file_item_id].clone()
95} 95}
96 96
97/// Item map is the result of the name resolution. Item map contains, for each 97/// Item map is the result of the name resolution. Item map contains, for each
@@ -155,7 +155,7 @@ pub(crate) struct NamedImport {
155 155
156impl NamedImport { 156impl NamedImport {
157 pub(crate) fn range(&self, db: &impl HirDatabase, file_id: FileId) -> TextRange { 157 pub(crate) fn range(&self, db: &impl HirDatabase, file_id: FileId) -> TextRange {
158 let syntax = db._file_item(file_id, self.file_item_id); 158 let syntax = db.file_item(file_id, self.file_item_id);
159 let offset = syntax.borrowed().range().start(); 159 let offset = syntax.borrowed().range().start();
160 self.relative_range + offset 160 self.relative_range + offset
161 } 161 }
@@ -172,9 +172,9 @@ pub(crate) fn input_module_items(
172 source_root: SourceRootId, 172 source_root: SourceRootId,
173 module_id: ModuleId, 173 module_id: ModuleId,
174) -> Cancelable<Arc<InputModuleItems>> { 174) -> Cancelable<Arc<InputModuleItems>> {
175 let module_tree = db._module_tree(source_root)?; 175 let module_tree = db.module_tree(source_root)?;
176 let source = module_id.source(&module_tree); 176 let source = module_id.source(&module_tree);
177 let file_items = db._file_items(source.file_id()); 177 let file_items = db.file_items(source.file_id());
178 let res = match source.resolve(db) { 178 let res = match source.resolve(db) {
179 ModuleSourceNode::SourceFile(it) => { 179 ModuleSourceNode::SourceFile(it) => {
180 let items = it.borrowed().items(); 180 let items = it.borrowed().items();
@@ -197,11 +197,11 @@ pub(crate) fn item_map(
197 source_root: SourceRootId, 197 source_root: SourceRootId,
198) -> Cancelable<Arc<ItemMap>> { 198) -> Cancelable<Arc<ItemMap>> {
199 let start = Instant::now(); 199 let start = Instant::now();
200 let module_tree = db._module_tree(source_root)?; 200 let module_tree = db.module_tree(source_root)?;
201 let input = module_tree 201 let input = module_tree
202 .modules() 202 .modules()
203 .map(|id| { 203 .map(|id| {
204 let items = db._input_module_items(source_root, id)?; 204 let items = db.input_module_items(source_root, id)?;
205 Ok((id, items)) 205 Ok((id, items))
206 }) 206 })
207 .collect::<Cancelable<FxHashMap<_, _>>>()?; 207 .collect::<Cancelable<FxHashMap<_, _>>>()?;
@@ -460,7 +460,7 @@ mod tests {
460 .unwrap() 460 .unwrap()
461 .unwrap(); 461 .unwrap();
462 let module_id = descr.module_id; 462 let module_id = descr.module_id;
463 (db._item_map(source_root).unwrap(), module_id) 463 (db.item_map(source_root).unwrap(), module_id)
464 } 464 }
465 465
466 #[test] 466 #[test]
@@ -513,9 +513,9 @@ mod tests {
513 { 513 {
514 let db = host.analysis().imp.db; 514 let db = host.analysis().imp.db;
515 let events = db.log_executed(|| { 515 let events = db.log_executed(|| {
516 db._item_map(source_root).unwrap(); 516 db.item_map(source_root).unwrap();
517 }); 517 });
518 assert!(format!("{:?}", events).contains("_item_map")) 518 assert!(format!("{:?}", events).contains("item_map"))
519 } 519 }
520 520
521 let mut change = AnalysisChange::new(); 521 let mut change = AnalysisChange::new();
@@ -537,7 +537,7 @@ mod tests {
537 { 537 {
538 let db = host.analysis().imp.db; 538 let db = host.analysis().imp.db;
539 let events = db.log_executed(|| { 539 let events = db.log_executed(|| {
540 db._item_map(source_root).unwrap(); 540 db.item_map(source_root).unwrap();
541 }); 541 });
542 assert!( 542 assert!(
543 !format!("{:?}", events).contains("_item_map"), 543 !format!("{:?}", events).contains("_item_map"),