mirror of https://github.com/astral-sh/ruff
retain parentheses for if exprs
This commit is contained in:
parent
9589542c60
commit
c1ba13e3e9
|
|
@ -89,7 +89,7 @@ impl NeedsParentheses for ExprIf {
|
|||
parent: AnyNodeRef,
|
||||
_context: &PyFormatContext,
|
||||
) -> OptionalParentheses {
|
||||
if parent.is_expr_await() {
|
||||
if parent.is_expr_await() || parent.is_comprehension() {
|
||||
OptionalParentheses::Always
|
||||
} else {
|
||||
OptionalParentheses::Multiline
|
||||
|
|
|
|||
Loading…
Reference in New Issue