mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-13 23:28:13 +00:00
Split tuples in return positions by comma first (#8280)
This commit is contained in:
parent
3ccca332bd
commit
c7aa816f17
3 changed files with 117 additions and 2 deletions
|
@ -172,10 +172,13 @@ impl FormatNodeRule<ExprTuple> for FormatExprTuple {
|
|||
.finish()
|
||||
}
|
||||
TupleParentheses::Preserve => group(&ExprSequence::new(item)).fmt(f),
|
||||
TupleParentheses::NeverPreserve | TupleParentheses::OptionalParentheses => {
|
||||
TupleParentheses::NeverPreserve => {
|
||||
optional_parentheses(&ExprSequence::new(item)).fmt(f)
|
||||
}
|
||||
TupleParentheses::Default => {
|
||||
TupleParentheses::OptionalParentheses if item.elts.len() == 2 => {
|
||||
optional_parentheses(&ExprSequence::new(item)).fmt(f)
|
||||
}
|
||||
TupleParentheses::Default | TupleParentheses::OptionalParentheses => {
|
||||
parenthesize_if_expands(&ExprSequence::new(item)).fmt(f)
|
||||
}
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue