diff options
author | Aleksey Kladov <[email protected]> | 2019-11-21 10:32:03 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2019-11-21 10:48:05 +0000 |
commit | 621cf06156975f8bd75e35af46da034f72e11fad (patch) | |
tree | f06e26fc377bd36961a5c8fb41e01423e4e1a01d /crates/ra_hir/src/from_id.rs | |
parent | 24964ca58e057b3f32d5cbb17d84e46f2a236ff6 (diff) |
Decouple
Diffstat (limited to 'crates/ra_hir/src/from_id.rs')
-rw-r--r-- | crates/ra_hir/src/from_id.rs | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/crates/ra_hir/src/from_id.rs b/crates/ra_hir/src/from_id.rs index 7042422cc..e294e957b 100644 --- a/crates/ra_hir/src/from_id.rs +++ b/crates/ra_hir/src/from_id.rs | |||
@@ -4,12 +4,13 @@ | |||
4 | //! are splitting the hir. | 4 | //! are splitting the hir. |
5 | 5 | ||
6 | use hir_def::{ | 6 | use hir_def::{ |
7 | AdtId, AssocItemId, DefWithBodyId, EnumId, EnumVariantId, GenericDefId, ModuleDefId, StructId, | 7 | AdtId, AssocItemId, ConstId, DefWithBodyId, EnumId, EnumVariantId, FunctionId, GenericDefId, |
8 | TypeAliasId, UnionId, | 8 | ModuleDefId, StaticId, StructId, TypeAliasId, UnionId, |
9 | }; | 9 | }; |
10 | 10 | ||
11 | use crate::{ | 11 | use crate::{ |
12 | ty::TypableDef, Adt, AssocItem, DefWithBody, EnumVariant, GenericDef, ModuleDef, TypeAlias, | 12 | ty::TypableDef, Adt, AssocItem, Const, DefWithBody, EnumVariant, Function, GenericDef, |
13 | ModuleDef, Static, TypeAlias, | ||
13 | }; | 14 | }; |
14 | 15 | ||
15 | macro_rules! from_id { | 16 | macro_rules! from_id { |
@@ -174,6 +175,22 @@ impl From<TypeAliasId> for TypableDef { | |||
174 | } | 175 | } |
175 | } | 176 | } |
176 | 177 | ||
178 | impl From<FunctionId> for TypableDef { | ||
179 | fn from(id: FunctionId) -> Self { | ||
180 | Function::from(id).into() | ||
181 | } | ||
182 | } | ||
183 | impl From<ConstId> for TypableDef { | ||
184 | fn from(id: ConstId) -> Self { | ||
185 | Const::from(id).into() | ||
186 | } | ||
187 | } | ||
188 | impl From<StaticId> for TypableDef { | ||
189 | fn from(id: StaticId) -> Self { | ||
190 | Static::from(id).into() | ||
191 | } | ||
192 | } | ||
193 | |||
177 | impl From<Adt> for GenericDefId { | 194 | impl From<Adt> for GenericDefId { |
178 | fn from(id: Adt) -> Self { | 195 | fn from(id: Adt) -> Self { |
179 | match id { | 196 | match id { |