diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-06-28 23:37:25 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2020-06-28 23:37:25 +0100 |
commit | ca31b1d63ae91a69f1ce9c0b075403834ba19f38 (patch) | |
tree | df719c1ccd7cbd174b79ca50ffd0052731d1ea86 /crates/ra_ide | |
parent | 11f31ae4c3a38831609e4591e751ce10c4e38daf (diff) | |
parent | 36128c170d9d938cfcc52bc851aaed1fab6a2ad9 (diff) |
Merge #5105
5105: Simlify with matches!() r=matklad a=Veetaha
Co-authored-by: Veetaha <[email protected]>
Diffstat (limited to 'crates/ra_ide')
-rw-r--r-- | crates/ra_ide/src/inlay_hints.rs | 6 | ||||
-rw-r--r-- | crates/ra_ide/src/join_lines.rs | 5 |
2 files changed, 3 insertions, 8 deletions
diff --git a/crates/ra_ide/src/inlay_hints.rs b/crates/ra_ide/src/inlay_hints.rs index 98fb34486..c87652555 100644 --- a/crates/ra_ide/src/inlay_hints.rs +++ b/crates/ra_ide/src/inlay_hints.rs | |||
@@ -313,10 +313,8 @@ fn get_string_representation(expr: &ast::Expr) -> Option<String> { | |||
313 | } | 313 | } |
314 | 314 | ||
315 | fn is_obvious_param(param_name: &str) -> bool { | 315 | fn is_obvious_param(param_name: &str) -> bool { |
316 | let is_obvious_param_name = match param_name { | 316 | let is_obvious_param_name = |
317 | "predicate" | "value" | "pat" | "rhs" | "other" => true, | 317 | matches!(param_name, "predicate" | "value" | "pat" | "rhs" | "other"); |
318 | _ => false, | ||
319 | }; | ||
320 | param_name.len() == 1 || is_obvious_param_name | 318 | param_name.len() == 1 || is_obvious_param_name |
321 | } | 319 | } |
322 | 320 | ||
diff --git a/crates/ra_ide/src/join_lines.rs b/crates/ra_ide/src/join_lines.rs index 5036c1fb0..6907c09e8 100644 --- a/crates/ra_ide/src/join_lines.rs +++ b/crates/ra_ide/src/join_lines.rs | |||
@@ -165,10 +165,7 @@ fn join_single_use_tree(edit: &mut TextEditBuilder, token: &SyntaxToken) -> Opti | |||
165 | } | 165 | } |
166 | 166 | ||
167 | fn is_trailing_comma(left: SyntaxKind, right: SyntaxKind) -> bool { | 167 | fn is_trailing_comma(left: SyntaxKind, right: SyntaxKind) -> bool { |
168 | match (left, right) { | 168 | matches!((left, right), (T![,], T![')']) | (T![,], T![']'])) |
169 | (T![,], T![')']) | (T![,], T![']']) => true, | ||
170 | _ => false, | ||
171 | } | ||
172 | } | 169 | } |
173 | 170 | ||
174 | #[cfg(test)] | 171 | #[cfg(test)] |