mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-21 17:52:12 +03:00
Remove superfluous spaces in pretty-printing of loops
(And extra parens around else-if tests)
This commit is contained in:
@@ -615,9 +615,7 @@ fn do_else(s: &ps, els: option::t[@ast::expr]) {
|
||||
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_opt(s: &ps, expr: &option::t[@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_local(s: &ps, loc: &@ast::local) {
|
||||
|
||||
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) {
|
||||
|
||||
Reference in New Issue
Block a user