Skip to content

Commit

Permalink
Small chore
Browse files Browse the repository at this point in the history
  • Loading branch information
cnpryer committed Jul 15, 2023
1 parent 76589e2 commit 0e9a156
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions crates/ruff_python_formatter/src/expression/expr_tuple.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,16 +120,14 @@ impl FormatNodeRule<ExprTuple> for FormatExprTuple {
parenthesized("(", &ExprSequence::new(item), ")").fmt(f)
}
_ => match self.parentheses {
TupleParentheses::Subscript => group(&ExprSequence::new(item)).fmt(f),
_ if self.parentheses != TupleParentheses::Comprehension => {
parenthesize_if_expands(&ExprSequence::new(item)).fmt(f)
}
_ => {
TupleParentheses::Comprehension => {
let separator = format_with(|f| write!(f, [text(","), space()]));
f.join_with(separator)
.entries(item.elts.iter().formatted())
.finish()
}
TupleParentheses::Subscript => group(&ExprSequence::new(item)).fmt(f),
_ => parenthesize_if_expands(&ExprSequence::new(item)).fmt(f),
},
}
}
Expand Down

0 comments on commit 0e9a156

Please sign in to comment.