diff options
author | Alan Du <[email protected]> | 2019-06-04 07:38:13 +0100 |
---|---|---|
committer | Alan Du <[email protected]> | 2019-06-04 23:05:07 +0100 |
commit | ed3d93b875f25da6f81b8a107a8c200311240627 (patch) | |
tree | 77da821f9b00fc68e22f93aa5dba9989c8fcf0a7 | |
parent | 682bf04bf4a84e9c309b4ad2079ff08a3b09770b (diff) |
Fix clippy::single_char_pattern
-rw-r--r-- | crates/ra_assists/src/introduce_variable.rs | 4 | ||||
-rw-r--r-- | crates/ra_hir/src/expr/validation.rs | 7 | ||||
-rw-r--r-- | crates/ra_project_model/src/lib.rs | 2 | ||||
-rw-r--r-- | crates/ra_syntax/src/ast/extensions.rs | 2 |
4 files changed, 6 insertions, 9 deletions
diff --git a/crates/ra_assists/src/introduce_variable.rs b/crates/ra_assists/src/introduce_variable.rs index fb7333c8c..28467d341 100644 --- a/crates/ra_assists/src/introduce_variable.rs +++ b/crates/ra_assists/src/introduce_variable.rs | |||
@@ -57,9 +57,9 @@ pub(crate) fn introduce_variable(mut ctx: AssistCtx<impl HirDatabase>) -> Option | |||
57 | if text.starts_with("\r\n") { | 57 | if text.starts_with("\r\n") { |
58 | buf.push_str("\r\n"); | 58 | buf.push_str("\r\n"); |
59 | buf.push_str(text.trim_start_matches("\r\n")); | 59 | buf.push_str(text.trim_start_matches("\r\n")); |
60 | } else if text.starts_with("\n") { | 60 | } else if text.starts_with('\n') { |
61 | buf.push_str("\n"); | 61 | buf.push_str("\n"); |
62 | buf.push_str(text.trim_start_matches("\n")); | 62 | buf.push_str(text.trim_start_matches('\n')); |
63 | } else { | 63 | } else { |
64 | buf.push_str(text); | 64 | buf.push_str(text); |
65 | } | 65 | } |
diff --git a/crates/ra_hir/src/expr/validation.rs b/crates/ra_hir/src/expr/validation.rs index 592f558f2..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 | } |
diff --git a/crates/ra_project_model/src/lib.rs b/crates/ra_project_model/src/lib.rs index 63eb7041e..4ae7f685c 100644 --- a/crates/ra_project_model/src/lib.rs +++ b/crates/ra_project_model/src/lib.rs | |||
@@ -70,7 +70,7 @@ impl ProjectRoot { | |||
70 | }) | 70 | }) |
71 | }; | 71 | }; |
72 | 72 | ||
73 | let hidden = dir_path.components().any(|c| c.as_str().starts_with(".")); | 73 | let hidden = dir_path.components().any(|c| c.as_str().starts_with('.')); |
74 | 74 | ||
75 | !is_ignored && !hidden | 75 | !is_ignored && !hidden |
76 | } | 76 | } |
diff --git a/crates/ra_syntax/src/ast/extensions.rs b/crates/ra_syntax/src/ast/extensions.rs index e4c99784c..930b2d9fa 100644 --- a/crates/ra_syntax/src/ast/extensions.rs +++ b/crates/ra_syntax/src/ast/extensions.rs | |||
@@ -78,7 +78,7 @@ impl ast::Attr { | |||
78 | if attr.kind() == IDENT { | 78 | if attr.kind() == IDENT { |
79 | let key = attr.as_token()?.text().clone(); | 79 | let key = attr.as_token()?.text().clone(); |
80 | let val_node = tt_node.children_with_tokens().find(|t| t.kind() == STRING)?; | 80 | let val_node = tt_node.children_with_tokens().find(|t| t.kind() == STRING)?; |
81 | let val = val_node.as_token()?.text().trim_start_matches("\"").trim_end_matches("\""); | 81 | let val = val_node.as_token()?.text().trim_start_matches('"').trim_end_matches('"'); |
82 | Some((key, SmolStr::new(val))) | 82 | Some((key, SmolStr::new(val))) |
83 | } else { | 83 | } else { |
84 | None | 84 | None |