Parenthesize closures in unary ops and pre-emptively disallow multi-backpassing in such closures, to avoid formatter trouble later

This commit is contained in:
Joshua Warner 2025-01-01 12:22:09 -05:00
parent 14b18f4213
commit 37e7caa1aa
No known key found for this signature in database
GPG key ID: 89AD497003F93FDD
12 changed files with 77 additions and 53 deletions

View file

@ -267,7 +267,7 @@ fn format_expr_only(
)
|| (matches!(unary_op.value, called_via::UnaryOp::Negate)
&& requires_space_after_unary(&lifted.item))
|| (parens == Parens::InApply && ends_with_closure(&lifted.item));
|| ends_with_closure(&lifted.item);
if needs_parens {
// Unary negation can't be followed by whitespace (which is what a newline is) - so