fmt: remove extra parentheses (#14125)
parent
2080557f50
commit
26b0e7fd34
|
@ -2315,7 +2315,11 @@ pub fn (mut f Fmt) par_expr(node ast.ParExpr) {
|
|||
f.par_level++
|
||||
f.write('(')
|
||||
}
|
||||
f.expr(node.expr)
|
||||
mut expr := node.expr
|
||||
for mut expr is ast.ParExpr {
|
||||
expr = expr.expr
|
||||
}
|
||||
f.expr(expr)
|
||||
if requires_paren {
|
||||
f.par_level--
|
||||
f.write(')')
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
fn main() {
|
||||
_, _ := (22 > 11), (43 > 22)
|
||||
_ := (10 + 11)
|
||||
_ := (11 * 2)
|
||||
_ := (11 * 2)
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
fn main() {
|
||||
_, _ := (((22 > 11))), (43 > 22)
|
||||
_ := ((10 + 11))
|
||||
_ := ((((((11 * 2))))))
|
||||
_ := ((11 * 2))
|
||||
}
|
Loading…
Reference in New Issue