aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/from_id.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir/src/from_id.rs')
-rw-r--r--crates/ra_hir/src/from_id.rs24
1 files changed, 10 insertions, 14 deletions
diff --git a/crates/ra_hir/src/from_id.rs b/crates/ra_hir/src/from_id.rs
index 3a27d6f0c..619f6055e 100644
--- a/crates/ra_hir/src/from_id.rs
+++ b/crates/ra_hir/src/from_id.rs
@@ -137,20 +137,6 @@ impl From<GenericDef> for GenericDefId {
137 } 137 }
138} 138}
139 139
140impl From<GenericDefId> for GenericDef {
141 fn from(def: GenericDefId) -> Self {
142 match def {
143 GenericDefId::FunctionId(it) => GenericDef::Function(it.into()),
144 GenericDefId::AdtId(it) => GenericDef::Adt(it.into()),
145 GenericDefId::TraitId(it) => GenericDef::Trait(it.into()),
146 GenericDefId::TypeAliasId(it) => GenericDef::TypeAlias(it.into()),
147 GenericDefId::ImplId(it) => GenericDef::ImplBlock(it.into()),
148 GenericDefId::EnumVariantId(it) => GenericDef::EnumVariant(it.into()),
149 GenericDefId::ConstId(it) => GenericDef::Const(it.into()),
150 }
151 }
152}
153
154impl From<AdtId> for TypableDef { 140impl From<AdtId> for TypableDef {
155 fn from(id: AdtId) -> Self { 141 fn from(id: AdtId) -> Self {
156 Adt::from(id).into() 142 Adt::from(id).into()
@@ -244,3 +230,13 @@ impl From<AttrDef> for AttrDefId {
244 } 230 }
245 } 231 }
246} 232}
233
234impl From<AssocItem> for GenericDefId {
235 fn from(item: AssocItem) -> Self {
236 match item {
237 AssocItem::Function(f) => f.id.into(),
238 AssocItem::Const(c) => c.id.into(),
239 AssocItem::TypeAlias(t) => t.id.into(),
240 }
241 }
242}