aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/from_id.rs
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2019-11-25 12:39:45 +0000
committerGitHub <[email protected]>2019-11-25 12:39:45 +0000
commitc46cea2ad8239315d51952bfb1dad65c200dae7c (patch)
tree5cb05c66e7d6bfc51f206f27f561f3b54971c7b4 /crates/ra_hir/src/from_id.rs
parent9f7fcc6ecd5334c5e3caa365c4a6d7bf3f37b649 (diff)
parentc2a16632d0773dec707acb215297ef55b5c880fe (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.rs17
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
11use crate::{ 11use 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
17impl From<ra_db::CrateId> for Crate { 16impl From<ra_db::CrateId> for Crate {
@@ -214,18 +213,6 @@ impl From<Adt> for GenericDefId {
214 } 213 }
215} 214}
216 215
217impl 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
229impl From<VariantDef> for VariantId { 216impl From<VariantDef> for VariantId {
230 fn from(def: VariantDef) -> Self { 217 fn from(def: VariantDef) -> Self {
231 match def { 218 match def {