diff options
Diffstat (limited to 'crates/ra_ide_db/src/defs.rs')
-rw-r--r-- | crates/ra_ide_db/src/defs.rs | 17 |
1 files changed, 0 insertions, 17 deletions
diff --git a/crates/ra_ide_db/src/defs.rs b/crates/ra_ide_db/src/defs.rs index 80c99935d..df56f2d9e 100644 --- a/crates/ra_ide_db/src/defs.rs +++ b/crates/ra_ide_db/src/defs.rs | |||
@@ -6,7 +6,6 @@ | |||
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}, | ||
10 | Field, HasVisibility, ImplDef, Local, MacroDef, Module, ModuleDef, Name, PathResolution, | 9 | Field, HasVisibility, ImplDef, Local, MacroDef, Module, ModuleDef, Name, PathResolution, |
11 | Semantics, TypeParam, Visibility, | 10 | Semantics, TypeParam, Visibility, |
12 | }; | 11 | }; |
@@ -17,7 +16,6 @@ use ra_syntax::{ | |||
17 | }; | 16 | }; |
18 | 17 | ||
19 | use crate::RootDatabase; | 18 | use crate::RootDatabase; |
20 | use ra_hir_def::resolver::{HasResolver, Resolver}; | ||
21 | 19 | ||
22 | // FIXME: a more precise name would probably be `Symbol`? | 20 | // FIXME: a more precise name would probably be `Symbol`? |
23 | #[derive(Debug, PartialEq, Eq, Copy, Clone)] | 21 | #[derive(Debug, PartialEq, Eq, Copy, Clone)] |
@@ -78,21 +76,6 @@ impl Definition { | |||
78 | }; | 76 | }; |
79 | Some(name) | 77 | Some(name) |
80 | } | 78 | } |
81 | |||
82 | pub fn resolver<D: HirDatabase + DefDatabase>(&self, db: &D) -> Option<Resolver> { | ||
83 | use hir::VariantDef; | ||
84 | use ra_hir_def::*; | ||
85 | Some(match self { | ||
86 | Definition::ModuleDef(def) => def.resolver(db)?, | ||
87 | Definition::Field(field) => { | ||
88 | Into::<VariantId>::into(Into::<VariantDef>::into(field.parent_def(db))).resolver(db) | ||
89 | } | ||
90 | Definition::Macro(m) => Into::<ModuleId>::into(m.module(db)?).resolver(db), | ||
91 | Definition::SelfType(imp) => Into::<ImplId>::into(imp.clone()).resolver(db), | ||
92 | Definition::Local(local) => Into::<DefWithBodyId>::into(local.parent(db)).resolver(db), | ||
93 | Definition::TypeParam(tp) => Into::<ModuleId>::into(tp.module(db)).resolver(db), | ||
94 | }) | ||
95 | } | ||
96 | } | 79 | } |
97 | 80 | ||
98 | #[derive(Debug)] | 81 | #[derive(Debug)] |