diff options
Diffstat (limited to 'crates/ra_hir/src/from_id.rs')
-rw-r--r-- | crates/ra_hir/src/from_id.rs | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/crates/ra_hir/src/from_id.rs b/crates/ra_hir/src/from_id.rs index 619f6055e..38daa5e59 100644 --- a/crates/ra_hir/src/from_id.rs +++ b/crates/ra_hir/src/from_id.rs | |||
@@ -199,11 +199,22 @@ impl From<Adt> for GenericDefId { | |||
199 | } | 199 | } |
200 | } | 200 | } |
201 | 201 | ||
202 | impl From<VariantId> for VariantDef { | ||
203 | fn from(def: VariantId) -> Self { | ||
204 | match def { | ||
205 | VariantId::StructId(it) => VariantDef::Struct(it.into()), | ||
206 | VariantId::EnumVariantId(it) => VariantDef::EnumVariant(it.into()), | ||
207 | VariantId::UnionId(it) => VariantDef::Union(it.into()), | ||
208 | } | ||
209 | } | ||
210 | } | ||
211 | |||
202 | impl From<VariantDef> for VariantId { | 212 | impl From<VariantDef> for VariantId { |
203 | fn from(def: VariantDef) -> Self { | 213 | fn from(def: VariantDef) -> Self { |
204 | match def { | 214 | match def { |
205 | VariantDef::Struct(it) => VariantId::StructId(it.id), | 215 | VariantDef::Struct(it) => VariantId::StructId(it.id), |
206 | VariantDef::EnumVariant(it) => VariantId::EnumVariantId(it.into()), | 216 | VariantDef::EnumVariant(it) => VariantId::EnumVariantId(it.into()), |
217 | VariantDef::Union(it) => VariantId::UnionId(it.id), | ||
207 | } | 218 | } |
208 | } | 219 | } |
209 | } | 220 | } |
@@ -214,6 +225,12 @@ impl From<StructField> for StructFieldId { | |||
214 | } | 225 | } |
215 | } | 226 | } |
216 | 227 | ||
228 | impl From<StructFieldId> for StructField { | ||
229 | fn from(def: StructFieldId) -> Self { | ||
230 | StructField { parent: def.parent.into(), id: def.local_id } | ||
231 | } | ||
232 | } | ||
233 | |||
217 | impl From<AttrDef> for AttrDefId { | 234 | impl From<AttrDef> for AttrDefId { |
218 | fn from(def: AttrDef) -> Self { | 235 | fn from(def: AttrDef) -> Self { |
219 | match def { | 236 | match def { |