diff options
author | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-06-04 23:14:46 +0100 |
---|---|---|
committer | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-06-04 23:14:46 +0100 |
commit | 5deb907b4321d8328978d3322b0826b781814452 (patch) | |
tree | 2baa3b75b1ef62c02617c37ba9b800c41a3dd102 /crates/ra_hir/src/expr/validation.rs | |
parent | 8bd0e844247dc28d6ceb24b00f3cc3396bd5bf03 (diff) | |
parent | aa30c4909ebb1e85f1591f465c9e2875aa4d394e (diff) |
Merge #1374
1374: Implement `cargo lint` and fix some clippy errors r=alanhdu a=alanhdu
This creates a `cargo lint` command that runs clippy with certain lints disabled. I've also gone ahead and fixed some of the lint errors, although there are many more still to go.
cc #848
Co-authored-by: Alan Du <[email protected]>
Diffstat (limited to 'crates/ra_hir/src/expr/validation.rs')
-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() |