diff options
| author | Brian Anderson <banderson@mozilla.com> | 2012-07-01 16:40:15 -0700 |
|---|---|---|
| committer | Brian Anderson <banderson@mozilla.com> | 2012-07-01 17:53:07 -0700 |
| commit | 13a8f545388929a07af110a950441e6a1b88473a (patch) | |
| tree | de4015117976dd0b2e6c971a2508dc7ef1704eef /src/libsyntax | |
| parent | 3155d170ad782c505397f8b1da55b1d271db305f (diff) | |
| download | rust-13a8f545388929a07af110a950441e6a1b88473a.tar.gz rust-13a8f545388929a07af110a950441e6a1b88473a.zip | |
syntax: Pretty print new closures correctly
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/print/pprust.rs | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs index 9a994afb149..d085546f621 100644 --- a/src/libsyntax/print/pprust.rs +++ b/src/libsyntax/print/pprust.rs @@ -976,13 +976,12 @@ fn print_expr(s: ps, &&expr: @ast::expr) { print_block(s, body); } ast::expr_fn_block(decl, body, cap_clause) { - // containing cbox, will be closed by print-block at } - cbox(s, indent_unit); - // head-box, will be closed by print-block at start - ibox(s, 0u); - word(s.s, "{"); print_fn_block_args(s, decl, *cap_clause); - print_possibly_embedded_block(s, body, block_block_fn, indent_unit); + // The parser always adds an extra implicit block around lambdas + assert body.node.stmts.is_empty(); + assert body.node.expr.is_some(); + space(s.s); + print_expr(s, body.node.expr.get()); } ast::expr_loop_body(body) { print_expr(s, body); |
