diff options
| author | Brian Anderson <andersrb@gmail.com> | 2012-08-14 13:32:29 -0700 |
|---|---|---|
| committer | Brian Anderson <andersrb@gmail.com> | 2012-08-14 13:32:29 -0700 |
| commit | 350668579a4f3037fa4314fa03bcb97461896d4a (patch) | |
| tree | d88ea2907d32a5bcc6737eed4d3bd50253e2810d /src/libsyntax | |
| parent | 8e1f1e3b5208873e94f6de95c1f0f0b690a7aa89 (diff) | |
| parent | 62a9e16cb20b070dba25fed585a14f9e3a62ac3b (diff) | |
Merge pull request #3194 from dbp/pretty
Pretty printing brackets on match arms
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/print/pprust.rs | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs index b42c2dbdcc6..f4b6b74d1b5 100644 --- a/src/libsyntax/print/pprust.rs +++ b/src/libsyntax/print/pprust.rs @@ -838,6 +838,11 @@ fn print_block_unclosed(s: ps, blk: ast::blk) { false); } +fn print_block_unclosed_indent(s: ps, blk: ast::blk, indented: uint) { + print_possibly_embedded_block_(s, blk, block_normal, indented, ~[], + false); +} + fn print_block_with_attrs(s: ps, blk: ast::blk, attrs: ~[ast::attribute]) { print_possibly_embedded_block_(s, blk, block_normal, indent_unit, attrs, true); @@ -1178,8 +1183,16 @@ fn print_expr(s: ps, &&expr: @ast::expr) { assert arm.body.node.rules == ast::default_blk; match arm.body.node.expr { some(expr) => { - end(s); // close the ibox for the pattern - print_expr(s, expr); + match expr.node { + ast::expr_block(blk) => { + // the block will close the pattern's ibox + print_block_unclosed_indent(s, blk, alt_indent_unit); + } + _ => { + end(s); // close the ibox for the pattern + print_expr(s, expr); + } + } if !expr_is_simple_block(expr) && i < len - 1 { word(s.s, ~","); |
