Skip to content

Commit

Permalink
Merge pull request #1806 from dtolnay/closurebodyblock
Browse files Browse the repository at this point in the history
Fix `|| -> T 'a {}`
  • Loading branch information
dtolnay authored Dec 28, 2024
2 parents 6096823 + 6f57d63 commit 85133ea
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3464,7 +3464,9 @@ pub(crate) mod printing {
self.inputs.to_tokens(tokens);
self.or2_token.to_tokens(tokens);
self.output.to_tokens(tokens);
if matches!(self.output, ReturnType::Default) || matches!(*self.body, Expr::Block(_)) {
if matches!(self.output, ReturnType::Default)
|| matches!(&*self.body, Expr::Block(body) if body.attrs.is_empty() && body.label.is_none())
{
self.body.to_tokens(tokens);
} else {
token::Brace::default().surround(tokens, |tokens| {
Expand Down

0 comments on commit 85133ea

Please sign in to comment.