diff options
Diffstat (limited to 'crates/ra_hir/src/from_id.rs')
-rw-r--r-- | crates/ra_hir/src/from_id.rs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/crates/ra_hir/src/from_id.rs b/crates/ra_hir/src/from_id.rs index 75a1a7772..c16c17072 100644 --- a/crates/ra_hir/src/from_id.rs +++ b/crates/ra_hir/src/from_id.rs | |||
@@ -91,6 +91,22 @@ impl From<ModuleDefId> for ModuleDef { | |||
91 | } | 91 | } |
92 | } | 92 | } |
93 | 93 | ||
94 | impl From<ModuleDef> for ModuleDefId { | ||
95 | fn from(id: ModuleDef) -> Self { | ||
96 | match id { | ||
97 | ModuleDef::Module(it) => ModuleDefId::ModuleId(it.into()), | ||
98 | ModuleDef::Function(it) => ModuleDefId::FunctionId(it.into()), | ||
99 | ModuleDef::Adt(it) => ModuleDefId::AdtId(it.into()), | ||
100 | ModuleDef::EnumVariant(it) => ModuleDefId::EnumVariantId(it.into()), | ||
101 | ModuleDef::Const(it) => ModuleDefId::ConstId(it.into()), | ||
102 | ModuleDef::Static(it) => ModuleDefId::StaticId(it.into()), | ||
103 | ModuleDef::Trait(it) => ModuleDefId::TraitId(it.into()), | ||
104 | ModuleDef::TypeAlias(it) => ModuleDefId::TypeAliasId(it.into()), | ||
105 | ModuleDef::BuiltinType(it) => ModuleDefId::BuiltinType(it), | ||
106 | } | ||
107 | } | ||
108 | } | ||
109 | |||
94 | impl From<DefWithBody> for DefWithBodyId { | 110 | impl From<DefWithBody> for DefWithBodyId { |
95 | fn from(def: DefWithBody) -> Self { | 111 | fn from(def: DefWithBody) -> Self { |
96 | match def { | 112 | match def { |