aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide
diff options
context:
space:
mode:
authorVeetaha <[email protected]>2020-06-28 02:02:03 +0100
committerVeetaha <[email protected]>2020-06-28 02:03:59 +0100
commite75e2ae5b6b6b1364368ceb3d4081b6508b2f001 (patch)
treee88a9920a908bfdf66c156ab582ce90d77d55c2f /crates/ra_ide
parent513924a7e01ef81a03869249c902daf148439736 (diff)
Simlify with matches!()
Diffstat (limited to 'crates/ra_ide')
-rw-r--r--crates/ra_ide/src/inlay_hints.rs6
-rw-r--r--crates/ra_ide/src/join_lines.rs5
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 3fd08b1e8..886346991 100644
--- a/crates/ra_ide/src/inlay_hints.rs
+++ b/crates/ra_ide/src/inlay_hints.rs
@@ -312,10 +312,8 @@ fn get_string_representation(expr: &ast::Expr) -> Option<String> {
312} 312}
313 313
314fn is_obvious_param(param_name: &str) -> bool { 314fn is_obvious_param(param_name: &str) -> bool {
315 let is_obvious_param_name = match param_name { 315 let is_obvious_param_name =
316 "predicate" | "value" | "pat" | "rhs" | "other" => true, 316 matches!(param_name, "predicate" | "value" | "pat" | "rhs" | "other");
317 _ => false,
318 };
319 param_name.len() == 1 || is_obvious_param_name 317 param_name.len() == 1 || is_obvious_param_name
320} 318}
321 319
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
167fn is_trailing_comma(left: SyntaxKind, right: SyntaxKind) -> bool { 167fn 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)]