mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-28 06:14:54 +00:00
Introduce Token element (#7048)
This commit is contained in:
parent
2f3a950f6f
commit
c05e4628b1
78 changed files with 733 additions and 723 deletions
|
@ -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()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue