Use Expr::is_* methods in more matches (#7714)

This commit is contained in:
Charlie Marsh 2023-09-29 13:28:50 -04:00 committed by GitHub
parent bb65fb8486
commit b42a8972bf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 15 additions and 20 deletions

View file

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