Skip to content

Commit c67a34b

Browse files
committed
Binary ops should add parenthesis to each side
Otherwise, we get (1 + 2) * 3 looking like 1 + 2 * 3
1 parent a5d33d8 commit c67a34b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/libsyntax/print/pprust.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1670,10 +1670,10 @@ impl<'a> State<'a> {
16701670
op: ast::BinOp,
16711671
lhs: &ast::Expr,
16721672
rhs: &ast::Expr) -> io::Result<()> {
1673-
try!(self.print_expr(lhs));
1673+
try!(self.print_expr_maybe_paren(lhs));
16741674
try!(space(&mut self.s));
16751675
try!(self.word_space(ast_util::binop_to_string(op.node)));
1676-
self.print_expr(rhs)
1676+
self.print_expr_maybe_paren(rhs)
16771677
}
16781678

16791679
fn print_expr_unary(&mut self,

0 commit comments

Comments
 (0)