mirror of
https://github.com/astral-sh/ruff.git
synced 2025-07-23 13:05:06 +00:00
Add a with_dangling_comments
to the parenthesized formatter (#6402)
See: https://github.com/astral-sh/ruff/pull/6376#discussion_r1285514328.
This commit is contained in:
parent
bb96647d66
commit
8919b6ad9a
11 changed files with 60 additions and 82 deletions
|
@ -11,7 +11,7 @@ use crate::comments::{
|
|||
leading_comments, leading_node_comments, trailing_comments, CommentLinePosition, SourceComment,
|
||||
};
|
||||
use crate::context::{NodeLevel, WithNodeLevel};
|
||||
use crate::expression::parentheses::parenthesized_with_dangling_comments;
|
||||
use crate::expression::parentheses::parenthesized;
|
||||
use crate::prelude::*;
|
||||
use crate::FormatNodeRule;
|
||||
|
||||
|
@ -256,12 +256,8 @@ impl FormatNodeRule<Parameters> for FormatParameters {
|
|||
} else {
|
||||
write!(
|
||||
f,
|
||||
[parenthesized_with_dangling_comments(
|
||||
"(",
|
||||
parenthesis_dangling,
|
||||
&group(&format_inner),
|
||||
")"
|
||||
)]
|
||||
[parenthesized("(", &group(&format_inner), ")")
|
||||
.with_dangling_comments(parenthesis_dangling)]
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue