diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2019-11-25 12:39:45 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2019-11-25 12:39:45 +0000 |
commit | c46cea2ad8239315d51952bfb1dad65c200dae7c (patch) | |
tree | 5cb05c66e7d6bfc51f206f27f561f3b54971c7b4 /crates/ra_hir/src/from_id.rs | |
parent | 9f7fcc6ecd5334c5e3caa365c4a6d7bf3f37b649 (diff) | |
parent | c2a16632d0773dec707acb215297ef55b5c880fe (diff) |
Merge #2399
2399: Use GenericDefId more r=matklad a=matklad
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_hir/src/from_id.rs')
-rw-r--r-- | crates/ra_hir/src/from_id.rs | 17 |
1 files changed, 2 insertions, 15 deletions
diff --git a/crates/ra_hir/src/from_id.rs b/crates/ra_hir/src/from_id.rs index 529ac8251..3a27d6f0c 100644 --- a/crates/ra_hir/src/from_id.rs +++ b/crates/ra_hir/src/from_id.rs | |||
@@ -9,9 +9,8 @@ use hir_def::{ | |||
9 | }; | 9 | }; |
10 | 10 | ||
11 | use crate::{ | 11 | use crate::{ |
12 | ty::{CallableDef, TypableDef}, | 12 | ty::TypableDef, Adt, AssocItem, AttrDef, Const, Crate, DefWithBody, EnumVariant, Function, |
13 | Adt, AssocItem, AttrDef, Const, Crate, DefWithBody, EnumVariant, Function, GenericDef, | 13 | GenericDef, ModuleDef, Static, StructField, TypeAlias, VariantDef, |
14 | ModuleDef, Static, StructField, TypeAlias, VariantDef, | ||
15 | }; | 14 | }; |
16 | 15 | ||
17 | impl From<ra_db::CrateId> for Crate { | 16 | impl From<ra_db::CrateId> for Crate { |
@@ -214,18 +213,6 @@ impl From<Adt> for GenericDefId { | |||
214 | } | 213 | } |
215 | } | 214 | } |
216 | 215 | ||
217 | impl From<CallableDef> for GenericDefId { | ||
218 | fn from(def: CallableDef) -> Self { | ||
219 | match def { | ||
220 | CallableDef::Function(it) => it.id.into(), | ||
221 | CallableDef::Struct(it) => it.id.into(), | ||
222 | CallableDef::EnumVariant(it) => { | ||
223 | EnumVariantId { parent: it.parent.id, local_id: it.id }.into() | ||
224 | } | ||
225 | } | ||
226 | } | ||
227 | } | ||
228 | |||
229 | impl From<VariantDef> for VariantId { | 216 | impl From<VariantDef> for VariantId { |
230 | fn from(def: VariantDef) -> Self { | 217 | fn from(def: VariantDef) -> Self { |
231 | match def { | 218 | match def { |