diff options
author | Zac Pullar-Strecker <[email protected]> | 2020-08-24 09:26:45 +0100 |
---|---|---|
committer | Zac Pullar-Strecker <[email protected]> | 2020-08-24 09:26:45 +0100 |
commit | 4f5f608b499ad50aa66b2213e3b92dd2fe61ed68 (patch) | |
tree | 6ca8e205c82c5b50c4c4d77dcfe0bea09dfe31d7 /crates/ra_ide_db | |
parent | b34ad4bc8ad368a096c14d3710239a5a2eb9ccb5 (diff) |
Reorganise code
Diffstat (limited to 'crates/ra_ide_db')
-rw-r--r-- | crates/ra_ide_db/Cargo.toml | 1 | ||||
-rw-r--r-- | crates/ra_ide_db/src/defs.rs | 17 |
2 files changed, 0 insertions, 18 deletions
diff --git a/crates/ra_ide_db/Cargo.toml b/crates/ra_ide_db/Cargo.toml index f345f1de8..2716a38cc 100644 --- a/crates/ra_ide_db/Cargo.toml +++ b/crates/ra_ide_db/Cargo.toml | |||
@@ -26,7 +26,6 @@ ra_text_edit = { path = "../ra_text_edit" } | |||
26 | ra_db = { path = "../ra_db" } | 26 | ra_db = { path = "../ra_db" } |
27 | ra_prof = { path = "../ra_prof" } | 27 | ra_prof = { path = "../ra_prof" } |
28 | test_utils = { path = "../test_utils" } | 28 | test_utils = { path = "../test_utils" } |
29 | ra_hir_def = { path = "../ra_hir_def" } | ||
30 | 29 | ||
31 | # ra_ide should depend only on the top-level `hir` package. if you need | 30 | # ra_ide should depend only on the top-level `hir` package. if you need |
32 | # something from some `hir_xxx` subpackage, reexport the API via `hir`. | 31 | # something from some `hir_xxx` subpackage, reexport the API via `hir`. |
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)] |