Use BestFit layout even for attributes with a short name (#6872)

This commit is contained in:
Micha Reiser 2023-08-25 17:47:02 +02:00 committed by GitHub
parent 15b7525464
commit 29a0c1003b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 22 additions and 0 deletions

View file

@ -153,6 +153,8 @@ impl NeedsParentheses for ExprAttribute {
OptionalParentheses::Multiline
} else if context.comments().has_dangling(self) {
OptionalParentheses::Always
} else if self.value.is_name_expr() {
OptionalParentheses::BestFit
} else {
self.value.needs_parentheses(self.into(), context)
}