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

@ -140,12 +140,12 @@ impl FormatNodeRule<ExprTuple> for FormatExprTuple {
TupleParentheses::Preserve
if !is_tuple_parenthesized(item, f.context().source()) =>
{
write!(f, [single.format(), text(",")])
write!(f, [single.format(), token(",")])
}
_ =>
// A single element tuple always needs parentheses and a trailing comma, except when inside of a subscript
{
parenthesized("(", &format_args![single.format(), text(",")], ")")
parenthesized("(", &format_args![single.format(), token(",")], ")")
.with_dangling_comments(dangling)
.fmt(f)
}
@ -166,7 +166,7 @@ impl FormatNodeRule<ExprTuple> for FormatExprTuple {
_ => match self.parentheses {
TupleParentheses::Never => {
let separator =
format_with(|f| group(&format_args![text(","), space()]).fmt(f));
format_with(|f| group(&format_args![token(","), space()]).fmt(f));
f.join_with(separator)
.entries(elts.iter().formatted())
.finish()