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:
Charlie Marsh 2023-08-07 15:12:12 -04:00 committed by GitHub
parent bb96647d66
commit 8919b6ad9a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 60 additions and 82 deletions

View file

@ -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)]
)
}
}