diff options
Diffstat (limited to 'crates/ra_hir/src/from_source.rs')
-rw-r--r-- | crates/ra_hir/src/from_source.rs | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/crates/ra_hir/src/from_source.rs b/crates/ra_hir/src/from_source.rs index 30e818892..caaff012a 100644 --- a/crates/ra_hir/src/from_source.rs +++ b/crates/ra_hir/src/from_source.rs | |||
@@ -14,8 +14,7 @@ use ra_syntax::{ | |||
14 | 14 | ||
15 | use crate::{ | 15 | use crate::{ |
16 | db::{DefDatabase, HirDatabase}, | 16 | db::{DefDatabase, HirDatabase}, |
17 | Const, DefWithBody, Enum, Function, ImplBlock, InFile, Local, Module, SourceBinder, Static, | 17 | DefWithBody, InFile, Local, Module, SourceBinder, TypeParam, |
18 | Struct, Trait, TypeAlias, TypeParam, | ||
19 | }; | 18 | }; |
20 | 19 | ||
21 | impl Local { | 20 | impl Local { |
@@ -25,9 +24,9 @@ impl Local { | |||
25 | let parent: DefWithBody = src.value.syntax().ancestors().find_map(|it| { | 24 | let parent: DefWithBody = src.value.syntax().ancestors().find_map(|it| { |
26 | let res = match_ast! { | 25 | let res = match_ast! { |
27 | match it { | 26 | match it { |
28 | ast::ConstDef(value) => { sb.to_def::<Const, _>(InFile { value, file_id})?.into() }, | 27 | ast::ConstDef(value) => { sb.to_def(InFile { value, file_id})?.into() }, |
29 | ast::StaticDef(value) => { sb.to_def::<Static, _>(InFile { value, file_id})?.into() }, | 28 | ast::StaticDef(value) => { sb.to_def(InFile { value, file_id})?.into() }, |
30 | ast::FnDef(value) => { sb.to_def::<Function, _>(InFile { value, file_id})?.into() }, | 29 | ast::FnDef(value) => { sb.to_def(InFile { value, file_id})?.into() }, |
31 | _ => return None, | 30 | _ => return None, |
32 | } | 31 | } |
33 | }; | 32 | }; |
@@ -47,12 +46,12 @@ impl TypeParam { | |||
47 | let parent: GenericDefId = src.value.syntax().ancestors().find_map(|it| { | 46 | let parent: GenericDefId = src.value.syntax().ancestors().find_map(|it| { |
48 | let res = match_ast! { | 47 | let res = match_ast! { |
49 | match it { | 48 | match it { |
50 | ast::FnDef(value) => { sb.to_def::<Function, _>(InFile { value, file_id})?.id.into() }, | 49 | ast::FnDef(value) => { sb.to_def(InFile { value, file_id})?.id.into() }, |
51 | ast::StructDef(value) => { sb.to_def::<Struct, _>(InFile { value, file_id})?.id.into() }, | 50 | ast::StructDef(value) => { sb.to_def(InFile { value, file_id})?.id.into() }, |
52 | ast::EnumDef(value) => { sb.to_def::<Enum, _>(InFile { value, file_id})?.id.into() }, | 51 | ast::EnumDef(value) => { sb.to_def(InFile { value, file_id})?.id.into() }, |
53 | ast::TraitDef(value) => { sb.to_def::<Trait, _>(InFile { value, file_id})?.id.into() }, | 52 | ast::TraitDef(value) => { sb.to_def(InFile { value, file_id})?.id.into() }, |
54 | ast::TypeAliasDef(value) => { sb.to_def::<TypeAlias, _>(InFile { value, file_id})?.id.into() }, | 53 | ast::TypeAliasDef(value) => { sb.to_def(InFile { value, file_id})?.id.into() }, |
55 | ast::ImplBlock(value) => { sb.to_def::<ImplBlock, _>(InFile { value, file_id})?.id.into() }, | 54 | ast::ImplBlock(value) => { sb.to_def(InFile { value, file_id})?.id.into() }, |
56 | _ => return None, | 55 | _ => return None, |
57 | } | 56 | } |
58 | }; | 57 | }; |