diff options
Diffstat (limited to 'crates/ra_hir_def/src/item_tree')
-rw-r--r-- | crates/ra_hir_def/src/item_tree/lower.rs | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/crates/ra_hir_def/src/item_tree/lower.rs b/crates/ra_hir_def/src/item_tree/lower.rs index 0b1509e13..4182a9e3b 100644 --- a/crates/ra_hir_def/src/item_tree/lower.rs +++ b/crates/ra_hir_def/src/item_tree/lower.rs | |||
@@ -219,21 +219,20 @@ impl Ctx { | |||
219 | fn lower_tuple_fields(&mut self, fields: &ast::TupleFieldDefList) -> IdRange<Field> { | 219 | fn lower_tuple_fields(&mut self, fields: &ast::TupleFieldDefList) -> IdRange<Field> { |
220 | let start = self.next_field_idx(); | 220 | let start = self.next_field_idx(); |
221 | for (i, field) in fields.fields().enumerate() { | 221 | for (i, field) in fields.fields().enumerate() { |
222 | if let Some(data) = self.lower_tuple_field(i, &field) { | 222 | let data = self.lower_tuple_field(i, &field); |
223 | let idx = self.data().fields.alloc(data); | 223 | let idx = self.data().fields.alloc(data); |
224 | self.add_attrs(idx.into(), Attrs::new(&field, &self.hygiene)); | 224 | self.add_attrs(idx.into(), Attrs::new(&field, &self.hygiene)); |
225 | } | ||
226 | } | 225 | } |
227 | let end = self.next_field_idx(); | 226 | let end = self.next_field_idx(); |
228 | IdRange::new(start..end) | 227 | IdRange::new(start..end) |
229 | } | 228 | } |
230 | 229 | ||
231 | fn lower_tuple_field(&mut self, idx: usize, field: &ast::TupleFieldDef) -> Option<Field> { | 230 | fn lower_tuple_field(&mut self, idx: usize, field: &ast::TupleFieldDef) -> Field { |
232 | let name = Name::new_tuple_field(idx); | 231 | let name = Name::new_tuple_field(idx); |
233 | let visibility = self.lower_visibility(field); | 232 | let visibility = self.lower_visibility(field); |
234 | let type_ref = self.lower_type_ref(&field.type_ref()?); | 233 | let type_ref = self.lower_type_ref_opt(field.type_ref()); |
235 | let res = Field { name, type_ref, visibility }; | 234 | let res = Field { name, type_ref, visibility }; |
236 | Some(res) | 235 | res |
237 | } | 236 | } |
238 | 237 | ||
239 | fn lower_union(&mut self, union: &ast::UnionDef) -> Option<FileItemTreeId<Union>> { | 238 | fn lower_union(&mut self, union: &ast::UnionDef) -> Option<FileItemTreeId<Union>> { |