mirror of https://github.com/astral-sh/ruff
share dangling comment logic
This commit is contained in:
parent
4a66edf5f8
commit
93a958a734
|
|
@ -123,28 +123,20 @@ impl FormatNodeRule<ExprLambda> for FormatExprLambda {
|
|||
)?;
|
||||
}
|
||||
|
||||
write!(f, [token(":")])?;
|
||||
|
||||
if dangling_after_parameters.is_empty() {
|
||||
write!(f, [space()])?;
|
||||
} else if !preview {
|
||||
write!(f, [dangling_comments(dangling_after_parameters)])?;
|
||||
}
|
||||
|
||||
dangling_after_parameters
|
||||
} else {
|
||||
write!(f, [token(":")])?;
|
||||
|
||||
// In this context, a dangling comment is a comment between the `lambda` and the body.
|
||||
if dangling.is_empty() {
|
||||
write!(f, [space()])?;
|
||||
} else if !preview {
|
||||
write!(f, [dangling_comments(dangling)])?;
|
||||
}
|
||||
|
||||
dangling
|
||||
};
|
||||
|
||||
write!(f, [token(":")])?;
|
||||
|
||||
// In this context, a dangling comment is a comment between the `lambda` and the body.
|
||||
if dangling.is_empty() {
|
||||
write!(f, [space()])?;
|
||||
} else if !preview {
|
||||
write!(f, [dangling_comments(dangling)])?;
|
||||
}
|
||||
|
||||
FormatBody {
|
||||
body,
|
||||
dangling,
|
||||
|
|
|
|||
Loading…
Reference in New Issue