mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-29 13:25:17 +00:00
Avoid parenthesizing unsplittable because of comments (#8431)
This commit is contained in:
parent
a08c5b7fa7
commit
dd2d8cb579
8 changed files with 781 additions and 35 deletions
|
@ -20,7 +20,7 @@ impl FormatNodeRule<ExprAwait> for FormatExprAwait {
|
|||
[
|
||||
token("await"),
|
||||
space(),
|
||||
maybe_parenthesize_expression(value, item, Parenthesize::IfBreaks)
|
||||
maybe_parenthesize_expression(value, item, Parenthesize::IfRequired)
|
||||
]
|
||||
)
|
||||
}
|
||||
|
@ -39,6 +39,7 @@ impl NeedsParentheses for ExprAwait {
|
|||
context.comments().ranges(),
|
||||
context.source(),
|
||||
) {
|
||||
// Prefer splitting the value if it is parenthesized.
|
||||
OptionalParentheses::Never
|
||||
} else {
|
||||
self.value.needs_parentheses(self.into(), context)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue