aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide_db/src
diff options
context:
space:
mode:
authorZac Pullar-Strecker <[email protected]>2020-08-24 09:26:45 +0100
committerZac Pullar-Strecker <[email protected]>2020-08-24 09:26:45 +0100
commit4f5f608b499ad50aa66b2213e3b92dd2fe61ed68 (patch)
tree6ca8e205c82c5b50c4c4d77dcfe0bea09dfe31d7 /crates/ra_ide_db/src
parentb34ad4bc8ad368a096c14d3710239a5a2eb9ccb5 (diff)
Reorganise code
Diffstat (limited to 'crates/ra_ide_db/src')
-rw-r--r--crates/ra_ide_db/src/defs.rs17
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
8use hir::{ 8use 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
19use crate::RootDatabase; 18use crate::RootDatabase;
20use 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)]