Skip to content

Commit 85133ea

Browse files
authored
Merge pull request #1806 from dtolnay/closurebodyblock
Fix `|| -> T 'a {}`
2 parents 6096823 + 6f57d63 commit 85133ea

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/expr.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3464,7 +3464,9 @@ pub(crate) mod printing {
34643464
self.inputs.to_tokens(tokens);
34653465
self.or2_token.to_tokens(tokens);
34663466
self.output.to_tokens(tokens);
3467-
if matches!(self.output, ReturnType::Default) || matches!(*self.body, Expr::Block(_)) {
3467+
if matches!(self.output, ReturnType::Default)
3468+
|| matches!(&*self.body, Expr::Block(body) if body.attrs.is_empty() && body.label.is_none())
3469+
{
34683470
self.body.to_tokens(tokens);
34693471
} else {
34703472
token::Brace::default().surround(tokens, |tokens| {

0 commit comments

Comments
 (0)