Fix inconsistent expr_lambda formatting (#6318)

This commit is contained in:
qdegraaf 2023-09-08 11:40:58 +02:00 committed by GitHub
parent c260762900
commit 05951dd338
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 109 additions and 4 deletions

View file

@ -43,6 +43,11 @@ impl FormatNodeRule<ExprLambda> for FormatExprLambda {
write!(f, [dangling_comments(dangling)])?;
}
// Insert hard line break if body has leading comment to ensure consistent formatting
if comments.has_leading(body.as_ref()) {
write!(f, [hard_line_break()])?;
}
write!(f, [body.format()])
}