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

@ -27,9 +27,9 @@ impl<'ast> Format<PyFormatContext<'ast>> for ParenthesizeIfExpands<'_, 'ast> {
write!(
f,
[group(&format_args![
if_group_breaks(&text("(")),
if_group_breaks(&token("(")),
soft_block_indent(&Arguments::from(&self.inner)),
if_group_breaks(&text(")")),
if_group_breaks(&token(")")),
])]
)
}
@ -152,7 +152,7 @@ impl<'fmt, 'ast, 'buf> JoinCommaSeparatedBuilder<'fmt, 'ast, 'buf> {
{
self.result = self.result.and_then(|_| {
if self.entries.is_one_or_more() {
write!(self.fmt, [text(","), separator])?;
write!(self.fmt, [token(","), separator])?;
}
self.entries = self.entries.next(node.end());
@ -204,7 +204,7 @@ impl<'fmt, 'ast, 'buf> JoinCommaSeparatedBuilder<'fmt, 'ast, 'buf> {
|| self.trailing_comma == TrailingComma::OneOrMore
|| self.entries.is_more_than_one()
{
if_group_breaks(&text(",")).fmt(self.fmt)?;
if_group_breaks(&token(",")).fmt(self.fmt)?;
}
if magic_trailing_comma {