From 63ecc84562462830d08f1842fcf9b4fc3e35f754 Mon Sep 17 00:00:00 2001 From: Marijn Haverbeke Date: Thu, 15 Sep 2011 10:12:09 +0200 Subject: [PATCH] Also handle fail and put in print_maybe_parens_discrim Closes #920 --- src/comp/syntax/print/pprust.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/comp/syntax/print/pprust.rs b/src/comp/syntax/print/pprust.rs index 6d571d61d14..667f1255fde 100644 --- a/src/comp/syntax/print/pprust.rs +++ b/src/comp/syntax/print/pprust.rs @@ -594,8 +594,11 @@ fn print_possibly_embedded_block(s: ps, blk: ast::blk, embedded: embed_type, // ret and fail, without arguments cannot appear is the discriminant of if, // alt, do, & while unambiguously without being parenthesized fn print_maybe_parens_discrim(s: ps, e: @ast::expr) { - let disambig = - alt e.node { ast::expr_ret(option::none.) { true } _ { false } }; + let disambig = alt e.node { + ast::expr_ret(none.) | ast::expr_put(none.) | + ast::expr_fail(none.) { true } + _ { false } + }; if disambig { popen(s) } print_expr(s, e); if disambig { pclose(s) }