mirror of
https://github.com/astral-sh/ruff.git
synced 2025-07-16 01:25:22 +00:00
Use Expr::is_*
methods in more matches (#7714)
This commit is contained in:
parent
bb65fb8486
commit
b42a8972bf
6 changed files with 15 additions and 20 deletions
|
@ -361,7 +361,7 @@ fn can_omit_optional_parentheses(expr: &Expr, context: &PyFormatContext) -> bool
|
|||
} else {
|
||||
fn is_parenthesized(expr: &Expr, context: &PyFormatContext) -> bool {
|
||||
// Don't break subscripts except in parenthesized context. It looks weird.
|
||||
!matches!(expr, Expr::Subscript(_))
|
||||
!expr.is_subscript_expr()
|
||||
&& has_parentheses(expr, context).is_some_and(OwnParentheses::is_non_empty)
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue