diff options
Diffstat (limited to 'crates/ra_hir_def/src/adt.rs')
-rw-r--r-- | crates/ra_hir_def/src/adt.rs | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/crates/ra_hir_def/src/adt.rs b/crates/ra_hir_def/src/adt.rs index 2bdfc2b8d..d55c49938 100644 --- a/crates/ra_hir_def/src/adt.rs +++ b/crates/ra_hir_def/src/adt.rs | |||
@@ -52,14 +52,14 @@ pub struct StructFieldData { | |||
52 | } | 52 | } |
53 | 53 | ||
54 | impl StructData { | 54 | impl StructData { |
55 | pub(crate) fn struct_data_query(db: &impl DefDatabase, id: StructId) -> Arc<StructData> { | 55 | pub(crate) fn struct_data_query(db: &dyn DefDatabase, id: StructId) -> Arc<StructData> { |
56 | let src = id.lookup(db).source(db); | 56 | let src = id.lookup(db).source(db); |
57 | let name = src.value.name().map_or_else(Name::missing, |n| n.as_name()); | 57 | let name = src.value.name().map_or_else(Name::missing, |n| n.as_name()); |
58 | let variant_data = VariantData::new(db, src.map(|s| s.kind())); | 58 | let variant_data = VariantData::new(db, src.map(|s| s.kind())); |
59 | let variant_data = Arc::new(variant_data); | 59 | let variant_data = Arc::new(variant_data); |
60 | Arc::new(StructData { name, variant_data }) | 60 | Arc::new(StructData { name, variant_data }) |
61 | } | 61 | } |
62 | pub(crate) fn union_data_query(db: &impl DefDatabase, id: UnionId) -> Arc<StructData> { | 62 | pub(crate) fn union_data_query(db: &dyn DefDatabase, id: UnionId) -> Arc<StructData> { |
63 | let src = id.lookup(db).source(db); | 63 | let src = id.lookup(db).source(db); |
64 | let name = src.value.name().map_or_else(Name::missing, |n| n.as_name()); | 64 | let name = src.value.name().map_or_else(Name::missing, |n| n.as_name()); |
65 | let variant_data = VariantData::new( | 65 | let variant_data = VariantData::new( |
@@ -76,7 +76,7 @@ impl StructData { | |||
76 | } | 76 | } |
77 | 77 | ||
78 | impl EnumData { | 78 | impl EnumData { |
79 | pub(crate) fn enum_data_query(db: &impl DefDatabase, e: EnumId) -> Arc<EnumData> { | 79 | pub(crate) fn enum_data_query(db: &dyn DefDatabase, e: EnumId) -> Arc<EnumData> { |
80 | let _p = profile("enum_data_query"); | 80 | let _p = profile("enum_data_query"); |
81 | let src = e.lookup(db).source(db); | 81 | let src = e.lookup(db).source(db); |
82 | let name = src.value.name().map_or_else(Name::missing, |n| n.as_name()); | 82 | let name = src.value.name().map_or_else(Name::missing, |n| n.as_name()); |
@@ -94,7 +94,7 @@ impl EnumData { | |||
94 | impl HasChildSource for EnumId { | 94 | impl HasChildSource for EnumId { |
95 | type ChildId = LocalEnumVariantId; | 95 | type ChildId = LocalEnumVariantId; |
96 | type Value = ast::EnumVariant; | 96 | type Value = ast::EnumVariant; |
97 | fn child_source(&self, db: &impl DefDatabase) -> InFile<ArenaMap<Self::ChildId, Self::Value>> { | 97 | fn child_source(&self, db: &dyn DefDatabase) -> InFile<ArenaMap<Self::ChildId, Self::Value>> { |
98 | let src = self.lookup(db).source(db); | 98 | let src = self.lookup(db).source(db); |
99 | let mut trace = Trace::new_for_map(); | 99 | let mut trace = Trace::new_for_map(); |
100 | lower_enum(db, &mut trace, &src); | 100 | lower_enum(db, &mut trace, &src); |
@@ -103,7 +103,7 @@ impl HasChildSource for EnumId { | |||
103 | } | 103 | } |
104 | 104 | ||
105 | fn lower_enum( | 105 | fn lower_enum( |
106 | db: &impl DefDatabase, | 106 | db: &dyn DefDatabase, |
107 | trace: &mut Trace<LocalEnumVariantId, EnumVariantData, ast::EnumVariant>, | 107 | trace: &mut Trace<LocalEnumVariantId, EnumVariantData, ast::EnumVariant>, |
108 | ast: &InFile<ast::EnumDef>, | 108 | ast: &InFile<ast::EnumDef>, |
109 | ) { | 109 | ) { |
@@ -119,7 +119,7 @@ fn lower_enum( | |||
119 | } | 119 | } |
120 | 120 | ||
121 | impl VariantData { | 121 | impl VariantData { |
122 | fn new(db: &impl DefDatabase, flavor: InFile<ast::StructKind>) -> Self { | 122 | fn new(db: &dyn DefDatabase, flavor: InFile<ast::StructKind>) -> Self { |
123 | let mut trace = Trace::new_for_arena(); | 123 | let mut trace = Trace::new_for_arena(); |
124 | match lower_struct(db, &mut trace, &flavor) { | 124 | match lower_struct(db, &mut trace, &flavor) { |
125 | StructKind::Tuple => VariantData::Tuple(trace.into_arena()), | 125 | StructKind::Tuple => VariantData::Tuple(trace.into_arena()), |
@@ -153,7 +153,7 @@ impl HasChildSource for VariantId { | |||
153 | type ChildId = LocalStructFieldId; | 153 | type ChildId = LocalStructFieldId; |
154 | type Value = Either<ast::TupleFieldDef, ast::RecordFieldDef>; | 154 | type Value = Either<ast::TupleFieldDef, ast::RecordFieldDef>; |
155 | 155 | ||
156 | fn child_source(&self, db: &impl DefDatabase) -> InFile<ArenaMap<Self::ChildId, Self::Value>> { | 156 | fn child_source(&self, db: &dyn DefDatabase) -> InFile<ArenaMap<Self::ChildId, Self::Value>> { |
157 | let src = match self { | 157 | let src = match self { |
158 | VariantId::EnumVariantId(it) => { | 158 | VariantId::EnumVariantId(it) => { |
159 | // I don't really like the fact that we call into parent source | 159 | // I don't really like the fact that we call into parent source |
@@ -182,7 +182,7 @@ pub enum StructKind { | |||
182 | } | 182 | } |
183 | 183 | ||
184 | fn lower_struct( | 184 | fn lower_struct( |
185 | db: &impl DefDatabase, | 185 | db: &dyn DefDatabase, |
186 | trace: &mut Trace< | 186 | trace: &mut Trace< |
187 | LocalStructFieldId, | 187 | LocalStructFieldId, |
188 | StructFieldData, | 188 | StructFieldData, |