diff --git a/crates/ruff_python_formatter/src/expression/expr_lambda.rs b/crates/ruff_python_formatter/src/expression/expr_lambda.rs index c4f67d4690..b2afdeea99 100644 --- a/crates/ruff_python_formatter/src/expression/expr_lambda.rs +++ b/crates/ruff_python_formatter/src/expression/expr_lambda.rs @@ -271,6 +271,8 @@ impl Format> for FormatBody<'_> { { trailing_comments(dangling).fmt(f)?; + // Note that `leading_body_comments` have already been formatted as part of + // `dangling` above, but their presence still determines the spacing here. if leading_body_comments.is_empty() { space().fmt(f)?; } else {