diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-04-30 21:27:07 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2020-04-30 21:27:07 +0100 |
commit | 6d49c7dfa3ae33e610905522caf5734c7cbca3ac (patch) | |
tree | 1b6d98928ecc2a12c6385b01f8c2450b2af928bd /crates/ra_syntax/src | |
parent | 23c889694e4d983dfda4956ae083cf9387316669 (diff) | |
parent | 15cfa9a808be820ceafc2e957ea8532e8ec68f00 (diff) |
Merge #4231
4231: Fix a bunch of false-positives in join-lines r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <[email protected]>
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 | ||