Skip to content

Commit e121844

Browse files
committed
---
yaml --- r: 3063 b: refs/heads/master c: fa2b4d3 h: refs/heads/master i: 3061: 687e06c 3059: da430d3 3055: 5221592 v: v3
1 parent 6d9aacd commit e121844

File tree

2 files changed

+24
-42
lines changed

2 files changed

+24
-42
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: 471436a2996b2f141e6ceeac87362cfb321807ff
2+
refs/heads/master: fa2b4d3a8d09b90870fd4a477154429f7fb8c6d3

trunk/src/comp/pretty/pprust.rs

Lines changed: 23 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -164,9 +164,7 @@ fn commasep_cmnt[IN](&ps s, breaks b, vec[IN] elts, fn(&ps, &IN) op,
164164

165165
fn commasep_exprs(&ps s, breaks b, vec[@ast::expr] exprs) {
166166
fn expr_span(&@ast::expr expr) -> common::span {ret expr.span;}
167-
auto f = print_expr;
168-
auto gs = expr_span;
169-
commasep_cmnt[@ast::expr](s, b, exprs, f, gs);
167+
commasep_cmnt(s, b, exprs, print_expr, expr_span);
170168
}
171169

172170
fn print_mod(&ps s, ast::_mod _mod) {
@@ -210,8 +208,7 @@ fn print_type(&ps s, &ast::ty ty) {
210208
case (ast::ty_tup(?elts)) {
211209
word(s.s, "tup");
212210
popen(s);
213-
auto f = print_mt;
214-
commasep[ast::mt](s, inconsistent, elts, f);
211+
commasep(s, inconsistent, elts, print_mt);
215212
pclose(s);
216213
}
217214
case (ast::ty_rec(?fields)) {
@@ -227,9 +224,7 @@ fn print_type(&ps s, &ast::ty ty) {
227224
fn get_span(&ast::ty_field f) -> common::span {
228225
ret f.span;
229226
}
230-
auto f = print_field;
231-
auto gs = get_span;
232-
commasep_cmnt[ast::ty_field](s, consistent, fields, f, gs);
227+
commasep_cmnt(s, consistent, fields, print_field, get_span);
233228
pclose(s);
234229
}
235230
case (ast::ty_obj(?methods)) {
@@ -346,13 +341,12 @@ fn print_item(&ps s, &@ast::item item) {
346341
space(s.s);
347342
maybe_print_comment(s, v.span.lo);
348343
word(s.s, v.node.name);
349-
if (vec::len[ast::variant_arg](v.node.args) > 0u) {
344+
if (vec::len(v.node.args) > 0u) {
350345
popen(s);
351346
fn print_variant_arg(&ps s, &ast::variant_arg arg) {
352347
print_type(s, *arg.ty);
353348
}
354-
auto f = print_variant_arg;
355-
commasep[ast::variant_arg](s, consistent, v.node.args, f);
349+
commasep(s, consistent, v.node.args, print_variant_arg);
356350
pclose(s);
357351
}
358352
word(s.s, ";");
@@ -373,9 +367,7 @@ fn print_item(&ps s, &@ast::item item) {
373367
end(s);
374368
}
375369
fn get_span(&ast::obj_field f) -> common::span {ret f.ty.span;}
376-
auto f = print_field;
377-
auto gs = get_span;
378-
commasep_cmnt[ast::obj_field](s, consistent, _obj.fields, f, gs);
370+
commasep_cmnt(s, consistent, _obj.fields, print_field, get_span);
379371
pclose(s);
380372
space(s.s);
381373
bopen(s);
@@ -488,9 +480,7 @@ fn print_expr(&ps s, &@ast::expr expr) {
488480
fn get_span(&ast::elt elt) -> common::span {ret elt.expr.span;}
489481
word(s.s, "tup");
490482
popen(s);
491-
auto f = printElt;
492-
auto gs = get_span;
493-
commasep_cmnt[ast::elt](s, inconsistent, exprs, f, gs);
483+
commasep_cmnt(s, inconsistent, exprs, printElt, get_span);
494484
pclose(s);
495485
}
496486
case (ast::expr_rec(?fields,?wth,_)) {
@@ -507,12 +497,10 @@ fn print_expr(&ps s, &@ast::expr expr) {
507497
}
508498
word(s.s, "rec");
509499
popen(s);
510-
auto f = print_field;
511-
auto gs = get_span;
512-
commasep_cmnt[ast::field](s, consistent, fields, f, gs);
500+
commasep_cmnt(s, consistent, fields, print_field, get_span);
513501
alt (wth) {
514502
case (some(?expr)) {
515-
if (vec::len[ast::field](fields) > 0u) {space(s.s);}
503+
if (vec::len(fields) > 0u) {space(s.s);}
516504
ibox(s, indent_unit);
517505
word_space(s, "with");
518506
print_expr(s, expr);
@@ -544,8 +532,7 @@ fn print_expr(&ps s, &@ast::expr expr) {
544532
word_nbsp(s, "bind");
545533
print_expr(s, func);
546534
popen(s);
547-
auto f = print_opt;
548-
commasep[option::t[@ast::expr]](s, inconsistent, args, f);
535+
commasep(s, inconsistent, args, print_opt);
549536
pclose(s);
550537
}
551538
case (ast::expr_spawn(_,_,?e,?es,_)) {
@@ -792,7 +779,7 @@ fn print_expr(&ps s, &@ast::expr expr) {
792779
case (ast::expr_ext(?path, ?args, ?body, _, _)) {
793780
word(s.s, "#");
794781
print_path(s, path);
795-
if (vec::len[@ast::expr](args) > 0u) {
782+
if (vec::len(args) > 0u) {
796783
popen(s);
797784
commasep_exprs(s, inconsistent, args);
798785
pclose(s);
@@ -896,7 +883,7 @@ fn print_ident(&ps s, &ast::ident ident) {
896883
}
897884

898885
fn print_for_decl(&ps s, @ast::local loc) {
899-
print_type(s, *option::get[@ast::ty](loc.node.ty));
886+
print_type(s, *option::get(loc.node.ty));
900887
space(s.s);
901888
word(s.s, loc.node.ident);
902889
}
@@ -909,10 +896,9 @@ fn print_path(&ps s, &ast::path path) {
909896
else {word(s.s, "::");}
910897
word(s.s, id);
911898
}
912-
if (vec::len[@ast::ty](path.node.types) > 0u) {
899+
if (vec::len(path.node.types) > 0u) {
913900
word(s.s, "[");
914-
auto f = print_boxed_type;
915-
commasep[@ast::ty](s, inconsistent, path.node.types, f);
901+
commasep(s, inconsistent, path.node.types, print_boxed_type);
916902
word(s.s, "]");
917903
}
918904
}
@@ -925,10 +911,9 @@ fn print_pat(&ps s, &@ast::pat pat) {
925911
case (ast::pat_lit(?lit,_)) {print_literal(s, lit);}
926912
case (ast::pat_tag(?path,?args,_)) {
927913
print_path(s, path);
928-
if (vec::len[@ast::pat](args) > 0u) {
914+
if (vec::len(args) > 0u) {
929915
popen(s);
930-
auto f = print_pat;
931-
commasep[@ast::pat](s, inconsistent, args, f);
916+
commasep(s, inconsistent, args, print_pat);
932917
pclose(s);
933918
}
934919
}
@@ -973,7 +958,7 @@ fn print_fn_args_and_ret(&ps s, &ast::fn_decl decl) {
973958
word(s.s, x.ident);
974959
end(s);
975960
}
976-
commasep[ast::arg](s, inconsistent, decl.inputs, print_arg);
961+
commasep(s, inconsistent, decl.inputs, print_arg);
977962
pclose(s);
978963
maybe_print_comment(s, decl.output.span.lo);
979964
if (decl.output.node != ast::ty_nil) {
@@ -992,13 +977,12 @@ fn print_alias(&ps s, ast::mode m) {
992977
}
993978

994979
fn print_type_params(&ps s, &vec[ast::ty_param] params) {
995-
if (vec::len[ast::ty_param](params) > 0u) {
980+
if (vec::len(params) > 0u) {
996981
word(s.s, "[");
997982
fn printParam(&ps s, &ast::ty_param param) {
998983
word(s.s, param);
999984
}
1000-
auto f = printParam;
1001-
commasep[ast::ty_param](s, inconsistent, params, f);
985+
commasep(s, inconsistent, params, printParam);
1002986
word(s.s, "]");
1003987
}
1004988
}
@@ -1010,7 +994,7 @@ fn print_view_item(&ps s, &@ast::view_item item) {
1010994
case (ast::view_item_use(?id,?mta,_,_)) {
1011995
head(s, "use");
1012996
word(s.s, id);
1013-
if (vec::len[@ast::meta_item](mta) > 0u) {
997+
if (vec::len(mta) > 0u) {
1014998
popen(s);
1015999
fn print_meta(&ps s, &@ast::meta_item item) {
10161000
ibox(s, indent_unit);
@@ -1019,14 +1003,13 @@ fn print_view_item(&ps s, &@ast::view_item item) {
10191003
print_string(s, item.node.value);
10201004
end(s);
10211005
}
1022-
auto f = print_meta;
1023-
commasep[@ast::meta_item](s, consistent, mta, f);
1006+
commasep(s, consistent, mta, print_meta);
10241007
pclose(s);
10251008
}
10261009
}
10271010
case (ast::view_item_import(?id,?ids,_)) {
10281011
head(s, "import");
1029-
if (!str::eq(id, ids.(vec::len[str](ids)-1u))) {
1012+
if (!str::eq(id, ids.(vec::len(ids)-1u))) {
10301013
word_space(s, id);
10311014
word_space(s, "=");
10321015
}
@@ -1112,8 +1095,7 @@ fn print_ty_fn(&ps s, &ast::proto proto, &option::t[str] id,
11121095
print_alias(s, input.node.mode);
11131096
print_type(s, *input.node.ty);
11141097
}
1115-
auto f = print_arg;
1116-
commasep[ast::ty_arg](s, inconsistent, inputs, f);
1098+
commasep(s, inconsistent, inputs, print_arg);
11171099
pclose(s);
11181100
maybe_print_comment(s, output.span.lo);
11191101
if (output.node != ast::ty_nil) {

0 commit comments

Comments
 (0)