diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-07-13 15:33:32 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2020-07-13 15:33:32 +0100 |
commit | 853440775d72974585ca3fe39f9688a4d4302dd3 (patch) | |
tree | 89272d8f03145df99fe68f0e35f8892dc4ab2c72 /crates/ra_hir_ty/src/lower.rs | |
parent | 4b1c3724364ff538acdcb44bdd23d501ef54cff3 (diff) | |
parent | 693ac892f2db5db1ce7cf86db7bf6207b3515c42 (diff) |
Merge #5342
5342: Don't copy-paste `impl_froms` into every crate r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_hir_ty/src/lower.rs')
-rw-r--r-- | crates/ra_hir_ty/src/lower.rs | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/crates/ra_hir_ty/src/lower.rs b/crates/ra_hir_ty/src/lower.rs index 3af8d55a1..101b8aebe 100644 --- a/crates/ra_hir_ty/src/lower.rs +++ b/crates/ra_hir_ty/src/lower.rs | |||
@@ -5,10 +5,7 @@ | |||
5 | //! - Building the type for an item: This happens through the `type_for_def` query. | 5 | //! - Building the type for an item: This happens through the `type_for_def` query. |
6 | //! | 6 | //! |
7 | //! This usually involves resolving names, collecting generic arguments etc. | 7 | //! This usually involves resolving names, collecting generic arguments etc. |
8 | use std::iter; | 8 | use std::{iter, sync::Arc}; |
9 | use std::sync::Arc; | ||
10 | |||
11 | use smallvec::SmallVec; | ||
12 | 9 | ||
13 | use hir_def::{ | 10 | use hir_def::{ |
14 | adt::StructKind, | 11 | adt::StructKind, |
@@ -24,6 +21,8 @@ use hir_def::{ | |||
24 | use hir_expand::name::Name; | 21 | use hir_expand::name::Name; |
25 | use ra_arena::map::ArenaMap; | 22 | use ra_arena::map::ArenaMap; |
26 | use ra_db::CrateId; | 23 | use ra_db::CrateId; |
24 | use smallvec::SmallVec; | ||
25 | use stdx::impl_from; | ||
27 | use test_utils::mark; | 26 | use test_utils::mark; |
28 | 27 | ||
29 | use crate::{ | 28 | use crate::{ |
@@ -1110,7 +1109,7 @@ pub enum CallableDef { | |||
1110 | StructId(StructId), | 1109 | StructId(StructId), |
1111 | EnumVariantId(EnumVariantId), | 1110 | EnumVariantId(EnumVariantId), |
1112 | } | 1111 | } |
1113 | impl_froms!(CallableDef: FunctionId, StructId, EnumVariantId); | 1112 | impl_from!(FunctionId, StructId, EnumVariantId for CallableDef); |
1114 | 1113 | ||
1115 | impl CallableDef { | 1114 | impl CallableDef { |
1116 | pub fn krate(self, db: &dyn HirDatabase) -> CrateId { | 1115 | pub fn krate(self, db: &dyn HirDatabase) -> CrateId { |
@@ -1140,7 +1139,7 @@ pub enum TyDefId { | |||
1140 | AdtId(AdtId), | 1139 | AdtId(AdtId), |
1141 | TypeAliasId(TypeAliasId), | 1140 | TypeAliasId(TypeAliasId), |
1142 | } | 1141 | } |
1143 | impl_froms!(TyDefId: BuiltinType, AdtId(StructId, EnumId, UnionId), TypeAliasId); | 1142 | impl_from!(BuiltinType, AdtId(StructId, EnumId, UnionId), TypeAliasId for TyDefId); |
1144 | 1143 | ||
1145 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] | 1144 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] |
1146 | pub enum ValueTyDefId { | 1145 | pub enum ValueTyDefId { |
@@ -1150,7 +1149,7 @@ pub enum ValueTyDefId { | |||
1150 | ConstId(ConstId), | 1149 | ConstId(ConstId), |
1151 | StaticId(StaticId), | 1150 | StaticId(StaticId), |
1152 | } | 1151 | } |
1153 | impl_froms!(ValueTyDefId: FunctionId, StructId, EnumVariantId, ConstId, StaticId); | 1152 | impl_from!(FunctionId, StructId, EnumVariantId, ConstId, StaticId for ValueTyDefId); |
1154 | 1153 | ||
1155 | /// Build the declared type of an item. This depends on the namespace; e.g. for | 1154 | /// Build the declared type of an item. This depends on the namespace; e.g. for |
1156 | /// `struct Foo(usize)`, we have two types: The type of the struct itself, and | 1155 | /// `struct Foo(usize)`, we have two types: The type of the struct itself, and |