aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_syntax/src
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_syntax/src')
-rw-r--r--crates/ra_syntax/src/ast/expr_extensions.rs5
-rw-r--r--crates/ra_syntax/src/ast/extensions.rs16
-rw-r--r--crates/ra_syntax/src/parsing/reparsing.rs5
3 files changed, 10 insertions, 16 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}
diff --git a/crates/ra_syntax/src/parsing/reparsing.rs b/crates/ra_syntax/src/parsing/reparsing.rs
index edbc190f8..ed5a42ea3 100644
--- a/crates/ra_syntax/src/parsing/reparsing.rs
+++ b/crates/ra_syntax/src/parsing/reparsing.rs
@@ -120,10 +120,7 @@ fn get_text_after_edit(element: SyntaxElement, edit: &Indel) -> String {
120} 120}
121 121
122fn is_contextual_kw(text: &str) -> bool { 122fn is_contextual_kw(text: &str) -> bool {
123 match text { 123 matches!(text, "auto" | "default" | "union")
124 "auto" | "default" | "union" => true,
125 _ => false,
126 }
127} 124}
128 125
129fn find_reparsable_node(node: &SyntaxNode, range: TextRange) -> Option<(SyntaxNode, Reparser)> { 126fn find_reparsable_node(node: &SyntaxNode, range: TextRange) -> Option<(SyntaxNode, Reparser)> {