mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-11 14:18:04 +00:00
Fix inconsistent expr_lambda
formatting (#6318)
This commit is contained in:
parent
c260762900
commit
05951dd338
3 changed files with 109 additions and 4 deletions
|
@ -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()])
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue