diff options
Diffstat (limited to 'crates/ra_ide_db')
-rw-r--r-- | crates/ra_ide_db/src/defs.rs | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/crates/ra_ide_db/src/defs.rs b/crates/ra_ide_db/src/defs.rs index a158169e3..b07395a64 100644 --- a/crates/ra_ide_db/src/defs.rs +++ b/crates/ra_ide_db/src/defs.rs | |||
@@ -6,8 +6,9 @@ | |||
6 | // FIXME: this badly needs rename/rewrite (matklad, 2020-02-06). | 6 | // FIXME: this badly needs rename/rewrite (matklad, 2020-02-06). |
7 | 7 | ||
8 | use hir::{ | 8 | use hir::{ |
9 | db::{DefDatabase, HirDatabase}, | ||
9 | Field, HasVisibility, ImplDef, Local, MacroDef, Module, ModuleDef, Name, PathResolution, | 10 | Field, HasVisibility, ImplDef, Local, MacroDef, Module, ModuleDef, Name, PathResolution, |
10 | Semantics, TypeParam, Visibility, db::{DefDatabase, HirDatabase}, | 11 | Semantics, TypeParam, Visibility, |
11 | }; | 12 | }; |
12 | use ra_prof::profile; | 13 | use ra_prof::profile; |
13 | use ra_syntax::{ | 14 | use ra_syntax::{ |
@@ -16,7 +17,7 @@ use ra_syntax::{ | |||
16 | }; | 17 | }; |
17 | 18 | ||
18 | use crate::RootDatabase; | 19 | use crate::RootDatabase; |
19 | use ra_hir_def::resolver::{Resolver, HasResolver}; | 20 | use ra_hir_def::resolver::{HasResolver, Resolver}; |
20 | 21 | ||
21 | // FIXME: a more precise name would probably be `Symbol`? | 22 | // FIXME: a more precise name would probably be `Symbol`? |
22 | #[derive(Debug, PartialEq, Eq, Copy, Clone)] | 23 | #[derive(Debug, PartialEq, Eq, Copy, Clone)] |
@@ -83,12 +84,14 @@ impl Definition { | |||
83 | use ra_hir_def::*; | 84 | use ra_hir_def::*; |
84 | Some(match self { | 85 | Some(match self { |
85 | Definition::ModuleDef(def) => def.resolver(db)?, | 86 | Definition::ModuleDef(def) => def.resolver(db)?, |
86 | Definition::Field(field) => Into::<VariantId>::into(Into::<VariantDef>::into(field.parent_def(db))).resolver(db), | 87 | Definition::Field(field) => { |
88 | Into::<VariantId>::into(Into::<VariantDef>::into(field.parent_def(db))).resolver(db) | ||
89 | } | ||
87 | Definition::Macro(m) => Into::<ModuleId>::into(m.module(db)?).resolver(db), | 90 | Definition::Macro(m) => Into::<ModuleId>::into(m.module(db)?).resolver(db), |
88 | Definition::SelfType(imp) => Into::<ImplId>::into(imp.clone()).resolver(db), | 91 | Definition::SelfType(imp) => Into::<ImplId>::into(imp.clone()).resolver(db), |
89 | // it's possible, read probable, that other arms of this are also unreachable | 92 | // it's possible, read probable, that other arms of this are also unreachable |
90 | Definition::Local(_local) => unreachable!(), | 93 | Definition::Local(_local) => unreachable!(), |
91 | Definition::TypeParam(tp) => Into::<ModuleId>::into(tp.module(db)).resolver(db) | 94 | Definition::TypeParam(tp) => Into::<ModuleId>::into(tp.module(db)).resolver(db), |
92 | }) | 95 | }) |
93 | } | 96 | } |
94 | } | 97 | } |