diff --git a/crates/ruff_python_formatter/src/expression/expr_lambda.rs b/crates/ruff_python_formatter/src/expression/expr_lambda.rs index ecf8023572..55b7d778e1 100644 --- a/crates/ruff_python_formatter/src/expression/expr_lambda.rs +++ b/crates/ruff_python_formatter/src/expression/expr_lambda.rs @@ -129,9 +129,7 @@ impl FormatNodeRule for FormatExprLambda { if dangling_after_parameters.is_empty() { write!(f, [space()])?; - } - // In preview, always parenthesize the body if there are dangling comments. - else if preview { + } else if preview { return FormatBody { body, dangling: dangling_after_parameters, @@ -147,9 +145,7 @@ impl FormatNodeRule for FormatExprLambda { // In this context, a dangling comment is a comment between the `lambda` and the body. if dangling.is_empty() { write!(f, [space()])?; - } - // In preview, always parenthesize the body if there are dangling comments. - else if preview { + } else if preview { return FormatBody { body, dangling,