mirror of https://github.com/astral-sh/ruff
inline parameters_have_comments
This commit is contained in:
parent
b80fdfa1a5
commit
4a66edf5f8
|
|
@ -36,8 +36,6 @@ impl FormatNodeRule<ExprLambda> for FormatExprLambda {
|
|||
write!(f, [token("lambda")])?;
|
||||
|
||||
let dangling = if let Some(parameters) = parameters {
|
||||
let parameters_have_comments = comments.contains_comments(parameters.into());
|
||||
|
||||
// In this context, a dangling comment can either be a comment between the `lambda` and the
|
||||
// parameters, or a comment between the parameters and the body.
|
||||
let (dangling_before_parameters, dangling_after_parameters) = dangling
|
||||
|
|
@ -108,7 +106,7 @@ impl FormatNodeRule<ExprLambda> for FormatExprLambda {
|
|||
}
|
||||
|
||||
// Try to keep the parameters on a single line, unless there are intervening comments.
|
||||
if preview && !parameters_have_comments {
|
||||
if preview && !comments.contains_comments(parameters.into()) {
|
||||
let mut buffer = RemoveSoftLinesBuffer::new(f);
|
||||
write!(
|
||||
buffer,
|
||||
|
|
|
|||
Loading…
Reference in New Issue