Introduce Token element (#7048)

This commit is contained in:
Micha Reiser 2023-09-02 10:05:47 +02:00 committed by GitHub
parent 2f3a950f6f
commit c05e4628b1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
78 changed files with 733 additions and 723 deletions

View file

@ -248,9 +248,9 @@ impl Format<PyFormatContext<'_>> for MaybeParenthesizeExpression<'_> {
// The group here is necessary because `format_expression` may contain IR elements
// that refer to the group id
group(&format_args![
text("("),
token("("),
soft_block_indent(&format_expression),
text(")")
token(")")
])
.with_group_id(Some(group_id))
.fmt(f)
@ -267,9 +267,9 @@ impl Format<PyFormatContext<'_>> for MaybeParenthesizeExpression<'_> {
// Variant 2:
// Try to fit the expression by adding parentheses and indenting the expression.
group(&format_args![
text("("),
token("("),
soft_block_indent(&format_expression),
text(")")
token(")")
])
.with_group_id(Some(group_id))
.should_expand(true),