aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/query_definitions.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir/src/query_definitions.rs')
-rw-r--r--crates/ra_hir/src/query_definitions.rs6
1 files changed, 4 insertions, 2 deletions
diff --git a/crates/ra_hir/src/query_definitions.rs b/crates/ra_hir/src/query_definitions.rs
index 37c4f9e4f..efaeb1525 100644
--- a/crates/ra_hir/src/query_definitions.rs
+++ b/crates/ra_hir/src/query_definitions.rs
@@ -38,7 +38,6 @@ pub(super) fn fn_scopes(db: &impl HirDatabase, fn_id: FnId) -> Arc<FnScopes> {
38pub(super) fn file_items(db: &impl HirDatabase, file_id: FileId) -> Arc<SourceFileItems> { 38pub(super) fn file_items(db: &impl HirDatabase, file_id: FileId) -> Arc<SourceFileItems> {
39 let mut res = SourceFileItems::new(file_id); 39 let mut res = SourceFileItems::new(file_id);
40 let source_file = db.source_file(file_id); 40 let source_file = db.source_file(file_id);
41 res.alloc(source_file.syntax().owned());
42 let source_file = source_file.borrowed(); 41 let source_file = source_file.borrowed();
43 source_file 42 source_file
44 .syntax() 43 .syntax()
@@ -52,7 +51,10 @@ pub(super) fn file_items(db: &impl HirDatabase, file_id: FileId) -> Arc<SourceFi
52} 51}
53 52
54pub(super) fn file_item(db: &impl HirDatabase, source_item_id: SourceItemId) -> SyntaxNode { 53pub(super) fn file_item(db: &impl HirDatabase, source_item_id: SourceItemId) -> SyntaxNode {
55 db.file_items(source_item_id.file_id)[source_item_id.item_id].clone() 54 match source_item_id.item_id {
55 Some(id) => db.file_items(source_item_id.file_id)[id].clone(),
56 None => db.source_file(source_item_id.file_id).syntax().owned(),
57 }
56} 58}
57 59
58pub(crate) fn submodules( 60pub(crate) fn submodules(