diff options
| author | Garming Sam <garming_sam@outlook.com> | 2015-08-06 18:43:02 +1200 |
|---|---|---|
| committer | Garming Sam <garming_sam@outlook.com> | 2015-08-09 21:15:47 +1200 |
| commit | c67a34b9e509b76ff145526f28a20f9495c2ab61 (patch) | |
| tree | 4cae786f2b12cb769d7b12ccbd97756b5e2ea5c4 | |
| parent | a5d33d8911d3ea691cb152bc582ee443ae3619da (diff) | |
| download | rust-c67a34b9e509b76ff145526f28a20f9495c2ab61.tar.gz rust-c67a34b9e509b76ff145526f28a20f9495c2ab61.zip | |
Binary ops should add parenthesis to each side
Otherwise, we get (1 + 2) * 3 looking like 1 + 2 * 3
| -rw-r--r-- | src/libsyntax/print/pprust.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs index 3b8ee91374c..147314739f8 100644 --- a/src/libsyntax/print/pprust.rs +++ b/src/libsyntax/print/pprust.rs @@ -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, |
