diff options
Diffstat (limited to 'crates/ra_hir/src/expr')
-rw-r--r-- | crates/ra_hir/src/expr/validation.rs | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/crates/ra_hir/src/expr/validation.rs b/crates/ra_hir/src/expr/validation.rs index 2816144a7..a1b2641da 100644 --- a/crates/ra_hir/src/expr/validation.rs +++ b/crates/ra_hir/src/expr/validation.rs | |||
@@ -31,11 +31,8 @@ impl<'a, 'b> ExprValidator<'a, 'b> { | |||
31 | pub(crate) fn validate_body(&mut self, db: &impl HirDatabase) { | 31 | pub(crate) fn validate_body(&mut self, db: &impl HirDatabase) { |
32 | let body = self.func.body(db); | 32 | let body = self.func.body(db); |
33 | for e in body.exprs() { | 33 | for e in body.exprs() { |
34 | match e { | 34 | if let (id, Expr::StructLit { path, fields, spread }) = e { |
35 | (id, Expr::StructLit { path, fields, spread }) => { | 35 | self.validate_struct_literal(id, path, fields, spread, db); |
36 | self.validate_struct_literal(id, path, fields, spread, db) | ||
37 | } | ||
38 | _ => (), | ||
39 | } | 36 | } |
40 | } | 37 | } |
41 | } | 38 | } |
@@ -44,7 +41,7 @@ impl<'a, 'b> ExprValidator<'a, 'b> { | |||
44 | &mut self, | 41 | &mut self, |
45 | id: ExprId, | 42 | id: ExprId, |
46 | _path: &Option<Path>, | 43 | _path: &Option<Path>, |
47 | fields: &Vec<StructLitField>, | 44 | fields: &[StructLitField], |
48 | spread: &Option<ExprId>, | 45 | spread: &Option<ExprId>, |
49 | db: &impl HirDatabase, | 46 | db: &impl HirDatabase, |
50 | ) { | 47 | ) { |
@@ -57,7 +54,7 @@ impl<'a, 'b> ExprValidator<'a, 'b> { | |||
57 | _ => return, | 54 | _ => return, |
58 | }; | 55 | }; |
59 | 56 | ||
60 | let lit_fields: FxHashSet<_> = fields.into_iter().map(|f| &f.name).collect(); | 57 | let lit_fields: FxHashSet<_> = fields.iter().map(|f| &f.name).collect(); |
61 | let missed_fields: Vec<Name> = struct_def | 58 | let missed_fields: Vec<Name> = struct_def |
62 | .fields(db) | 59 | .fields(db) |
63 | .iter() | 60 | .iter() |