aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir')
-rw-r--r--crates/ra_hir/src/impl_block.rs10
1 files changed, 5 insertions, 5 deletions
diff --git a/crates/ra_hir/src/impl_block.rs b/crates/ra_hir/src/impl_block.rs
index 162ab02b1..d26a024ed 100644
--- a/crates/ra_hir/src/impl_block.rs
+++ b/crates/ra_hir/src/impl_block.rs
@@ -4,7 +4,7 @@ use std::sync::Arc;
4use ra_arena::{impl_arena_id, map::ArenaMap, Arena, RawId}; 4use ra_arena::{impl_arena_id, map::ArenaMap, Arena, RawId};
5use ra_syntax::{ 5use ra_syntax::{
6 ast::{self, AstNode}, 6 ast::{self, AstNode},
7 AstPtr, SourceFile, 7 AstPtr,
8}; 8};
9 9
10use crate::{ 10use crate::{
@@ -29,12 +29,12 @@ impl ImplSourceMap {
29 } 29 }
30 30
31 pub fn get(&self, source: &ModuleSource, impl_id: ImplId) -> ast::ImplBlock { 31 pub fn get(&self, source: &ModuleSource, impl_id: ImplId) -> ast::ImplBlock {
32 let file = match source { 32 let root = match source {
33 ModuleSource::SourceFile(file) => file.clone(), 33 ModuleSource::SourceFile(file) => file.syntax().clone(),
34 ModuleSource::Module(m) => m.syntax().ancestors().find_map(SourceFile::cast).unwrap(), 34 ModuleSource::Module(m) => m.syntax().ancestors().last().unwrap(),
35 }; 35 };
36 36
37 self.map[impl_id].to_node(file.syntax()).to_owned() 37 self.map[impl_id].to_node(&root)
38 } 38 }
39} 39}
40 40