diff options
Diffstat (limited to 'crates/ra_syntax/src')
-rw-r--r-- | crates/ra_syntax/src/ast/expr_extensions.rs | 5 | ||||
-rw-r--r-- | crates/ra_syntax/src/ast/generated/nodes.rs | 1 |
2 files changed, 5 insertions, 1 deletions
diff --git a/crates/ra_syntax/src/ast/expr_extensions.rs b/crates/ra_syntax/src/ast/expr_extensions.rs index 93aa3d45f..ecf74fd36 100644 --- a/crates/ra_syntax/src/ast/expr_extensions.rs +++ b/crates/ra_syntax/src/ast/expr_extensions.rs | |||
@@ -368,12 +368,15 @@ impl ast::BlockExpr { | |||
368 | /// const FOO: () = { stand_alone }; | 368 | /// const FOO: () = { stand_alone }; |
369 | /// ``` | 369 | /// ``` |
370 | pub fn is_standalone(&self) -> bool { | 370 | pub fn is_standalone(&self) -> bool { |
371 | if self.unsafe_token().is_some() || self.async_token().is_some() { | ||
372 | return false; | ||
373 | } | ||
371 | let kind = match self.syntax().parent() { | 374 | let kind = match self.syntax().parent() { |
372 | None => return true, | 375 | None => return true, |
373 | Some(it) => it.kind(), | 376 | Some(it) => it.kind(), |
374 | }; | 377 | }; |
375 | match kind { | 378 | match kind { |
376 | FN_DEF | MATCH_ARM | IF_EXPR | WHILE_EXPR | LOOP_EXPR | TRY_BLOCK_EXPR => false, | 379 | FN_DEF | IF_EXPR | WHILE_EXPR | LOOP_EXPR | TRY_BLOCK_EXPR => false, |
377 | _ => true, | 380 | _ => true, |
378 | } | 381 | } |
379 | } | 382 | } |
diff --git a/crates/ra_syntax/src/ast/generated/nodes.rs b/crates/ra_syntax/src/ast/generated/nodes.rs index 3b5e05af9..d2253d4af 100644 --- a/crates/ra_syntax/src/ast/generated/nodes.rs +++ b/crates/ra_syntax/src/ast/generated/nodes.rs | |||
@@ -554,6 +554,7 @@ impl ast::AttrsOwner for BlockExpr {} | |||
554 | impl BlockExpr { | 554 | impl BlockExpr { |
555 | pub fn label(&self) -> Option<Label> { support::child(&self.syntax) } | 555 | pub fn label(&self) -> Option<Label> { support::child(&self.syntax) } |
556 | pub fn unsafe_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![unsafe]) } | 556 | pub fn unsafe_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![unsafe]) } |
557 | pub fn async_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![async]) } | ||
557 | pub fn block(&self) -> Option<Block> { support::child(&self.syntax) } | 558 | pub fn block(&self) -> Option<Block> { support::child(&self.syntax) } |
558 | } | 559 | } |
559 | 560 | ||