Binary ops should add parenthesis to each side
Otherwise, we get (1 + 2) * 3 looking like 1 + 2 * 3
This commit is contained in:
parent
a5d33d8911
commit
c67a34b9e5
1 changed files with 2 additions and 2 deletions
|
|
@ -1670,10 +1670,10 @@ impl<'a> State<'a> {
|
|||
op: ast::BinOp,
|
||||
lhs: &ast::Expr,
|
||||
rhs: &ast::Expr) -> io::Result<()> {
|
||||
try!(self.print_expr(lhs));
|
||||
try!(self.print_expr_maybe_paren(lhs));
|
||||
try!(space(&mut self.s));
|
||||
try!(self.word_space(ast_util::binop_to_string(op.node)));
|
||||
self.print_expr(rhs)
|
||||
self.print_expr_maybe_paren(rhs)
|
||||
}
|
||||
|
||||
fn print_expr_unary(&mut self,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue