From e75e2ae5b6b6b1364368ceb3d4081b6508b2f001 Mon Sep 17 00:00:00 2001 From: Veetaha Date: Sun, 28 Jun 2020 04:02:03 +0300 Subject: Simlify with matches!() --- crates/ra_ide/src/inlay_hints.rs | 6 ++---- crates/ra_ide/src/join_lines.rs | 5 +---- 2 files changed, 3 insertions(+), 8 deletions(-) (limited to 'crates/ra_ide/src') 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 { } fn is_obvious_param(param_name: &str) -> bool { - let is_obvious_param_name = match param_name { - "predicate" | "value" | "pat" | "rhs" | "other" => true, - _ => false, - }; + let is_obvious_param_name = + matches!(param_name, "predicate" | "value" | "pat" | "rhs" | "other"); param_name.len() == 1 || is_obvious_param_name } 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 } fn is_trailing_comma(left: SyntaxKind, right: SyntaxKind) -> bool { - match (left, right) { - (T![,], T![')']) | (T![,], T![']']) => true, - _ => false, - } + matches!((left, right), (T![,], T![')']) | (T![,], T![']'])) } #[cfg(test)] -- cgit v1.2.3