Fix a bunch of false-positives in join-lines
This commit is contained in:
@@ -368,12 +368,15 @@ impl ast::BlockExpr {
|
||||
/// const FOO: () = { stand_alone };
|
||||
/// ```
|
||||
pub fn is_standalone(&self) -> bool {
|
||||
if self.unsafe_token().is_some() || self.async_token().is_some() {
|
||||
return false;
|
||||
}
|
||||
let kind = match self.syntax().parent() {
|
||||
None => return true,
|
||||
Some(it) => it.kind(),
|
||||
};
|
||||
match kind {
|
||||
FN_DEF | MATCH_ARM | IF_EXPR | WHILE_EXPR | LOOP_EXPR | TRY_BLOCK_EXPR => false,
|
||||
FN_DEF | IF_EXPR | WHILE_EXPR | LOOP_EXPR | TRY_BLOCK_EXPR => false,
|
||||
_ => true,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -554,6 +554,7 @@ impl ast::AttrsOwner for BlockExpr {}
|
||||
impl BlockExpr {
|
||||
pub fn label(&self) -> Option<Label> { support::child(&self.syntax) }
|
||||
pub fn unsafe_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![unsafe]) }
|
||||
pub fn async_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![async]) }
|
||||
pub fn block(&self) -> Option<Block> { support::child(&self.syntax) }
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user