diff options
| author | Marijn Haverbeke <marijnh@gmail.com> | 2011-07-27 17:18:53 +0200 |
|---|---|---|
| committer | Marijn Haverbeke <marijnh@gmail.com> | 2011-07-27 17:18:53 +0200 |
| commit | 06e1d8b745bf73887390ed21ca58ae5688cbe208 (patch) | |
| tree | 390701b0efe3e85866220a3ca01697c772be6c57 /src/comp/syntax | |
| parent | 8365a79c7cac863343487cd73ffdedb3d2192d07 (diff) | |
| download | rust-06e1d8b745bf73887390ed21ca58ae5688cbe208.tar.gz rust-06e1d8b745bf73887390ed21ca58ae5688cbe208.zip | |
Remove superfluous spaces in pretty-printing of loops
(And extra parens around else-if tests)
Diffstat (limited to 'src/comp/syntax')
| -rw-r--r-- | src/comp/syntax/print/pprust.rs | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/src/comp/syntax/print/pprust.rs b/src/comp/syntax/print/pprust.rs index 623089ba150..80f691f5a9c 100644 --- a/src/comp/syntax/print/pprust.rs +++ b/src/comp/syntax/print/pprust.rs @@ -615,9 +615,7 @@ fn print_if(s: &ps, test: &@ast::expr, blk: &ast::blk, cbox(s, indent_unit - 1u); ibox(s, 0u); word(s.s, " else if "); - popen(s); print_expr(s, i); - pclose(s); space(s.s); print_block(s, t); do_else(s, e); @@ -775,19 +773,13 @@ fn print_expr(s: &ps, expr: &@ast::expr) { } ast::expr_for(decl, expr, blk) { head(s, "for"); - print_for_decl(s, decl); - space(s.s); - word_space(s, "in"); - print_expr(s, expr); + print_for_decl(s, decl, expr); space(s.s); print_block(s, blk); } ast::expr_for_each(decl, expr, blk) { head(s, "for each"); - print_for_decl(s, decl); - space(s.s); - word_space(s, "in"); - print_expr(s, expr); + print_for_decl(s, decl, expr); space(s.s); print_block(s, blk); } @@ -1043,13 +1035,15 @@ fn print_decl(s: &ps, decl: &@ast::decl) { fn print_ident(s: &ps, ident: &ast::ident) { word(s.s, ident); } -fn print_for_decl(s: &ps, loc: @ast::local) { +fn print_for_decl(s: &ps, loc: &@ast::local, coll: &@ast::expr) { word(s.s, loc.node.ident); alt loc.node.ty { some(t) { word_space(s, ":"); print_type(s, *t); } none. { } } space(s.s); + word_space(s, "in"); + print_expr(s, coll); } fn print_path(s: &ps, path: &ast::path) { |
