aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_syntax/src/ast
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2020-06-28 23:37:25 +0100
committerGitHub <[email protected]>2020-06-28 23:37:25 +0100
commitca31b1d63ae91a69f1ce9c0b075403834ba19f38 (patch)
treedf719c1ccd7cbd174b79ca50ffd0052731d1ea86 /crates/ra_syntax/src/ast
parent11f31ae4c3a38831609e4591e751ce10c4e38daf (diff)
parent36128c170d9d938cfcc52bc851aaed1fab6a2ad9 (diff)
Merge #5105
5105: Simlify with matches!() r=matklad a=Veetaha Co-authored-by: Veetaha <[email protected]>
Diffstat (limited to 'crates/ra_syntax/src/ast')
-rw-r--r--crates/ra_syntax/src/ast/expr_extensions.rs5
-rw-r--r--crates/ra_syntax/src/ast/extensions.rs16
2 files changed, 9 insertions, 12 deletions
diff --git a/crates/ra_syntax/src/ast/expr_extensions.rs b/crates/ra_syntax/src/ast/expr_extensions.rs
index 7771d6759..db5438d68 100644
--- a/crates/ra_syntax/src/ast/expr_extensions.rs
+++ b/crates/ra_syntax/src/ast/expr_extensions.rs
@@ -399,10 +399,7 @@ impl ast::BlockExpr {
399 Some(it) => it, 399 Some(it) => it,
400 None => return true, 400 None => return true,
401 }; 401 };
402 match parent.kind() { 402 !matches!(parent.kind(), FN_DEF | IF_EXPR | WHILE_EXPR | LOOP_EXPR | EFFECT_EXPR)
403 FN_DEF | IF_EXPR | WHILE_EXPR | LOOP_EXPR | EFFECT_EXPR => false,
404 _ => true,
405 }
406 } 403 }
407} 404}
408 405
diff --git a/crates/ra_syntax/src/ast/extensions.rs b/crates/ra_syntax/src/ast/extensions.rs
index 98c38d009..662c6f73e 100644
--- a/crates/ra_syntax/src/ast/extensions.rs
+++ b/crates/ra_syntax/src/ast/extensions.rs
@@ -459,16 +459,16 @@ impl ast::RangePat {
459 459
460impl ast::TokenTree { 460impl ast::TokenTree {
461 pub fn left_delimiter_token(&self) -> Option<SyntaxToken> { 461 pub fn left_delimiter_token(&self) -> Option<SyntaxToken> {
462 self.syntax().first_child_or_token()?.into_token().filter(|it| match it.kind() { 462 self.syntax()
463 T!['{'] | T!['('] | T!['['] => true, 463 .first_child_or_token()?
464 _ => false, 464 .into_token()
465 }) 465 .filter(|it| matches!(it.kind(), T!['{'] | T!['('] | T!['[']))
466 } 466 }
467 467
468 pub fn right_delimiter_token(&self) -> Option<SyntaxToken> { 468 pub fn right_delimiter_token(&self) -> Option<SyntaxToken> {
469 self.syntax().last_child_or_token()?.into_token().filter(|it| match it.kind() { 469 self.syntax()
470 T!['}'] | T![')'] | T![']'] => true, 470 .last_child_or_token()?
471 _ => false, 471 .into_token()
472 }) 472 .filter(|it| matches!(it.kind(), T!['}'] | T![')'] | T![']']))
473 } 473 }
474} 474}