aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide_db
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_ide_db')
-rw-r--r--crates/ra_ide_db/src/defs.rs11
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
8use hir::{ 8use 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};
12use ra_prof::profile; 13use ra_prof::profile;
13use ra_syntax::{ 14use ra_syntax::{
@@ -16,7 +17,7 @@ use ra_syntax::{
16}; 17};
17 18
18use crate::RootDatabase; 19use crate::RootDatabase;
19use ra_hir_def::resolver::{Resolver, HasResolver}; 20use 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}