@@ -164,9 +164,7 @@ fn commasep_cmnt[IN](&ps s, breaks b, vec[IN] elts, fn(&ps, &IN) op,
164
164
165
165
fn commasep_exprs ( & ps s, breaks b, vec[ @ast:: expr] exprs ) {
166
166
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) ;
170
168
}
171
169
172
170
fn print_mod ( & ps s, ast:: _mod _mod) {
@@ -210,8 +208,7 @@ fn print_type(&ps s, &ast::ty ty) {
210
208
case ( ast:: ty_tup ( ?elts) ) {
211
209
word ( s. s , "tup" ) ;
212
210
popen ( s) ;
213
- auto f = print_mt;
214
- commasep[ ast:: mt] ( s, inconsistent, elts, f) ;
211
+ commasep ( s, inconsistent, elts, print_mt) ;
215
212
pclose ( s) ;
216
213
}
217
214
case ( ast:: ty_rec ( ?fields) ) {
@@ -227,9 +224,7 @@ fn print_type(&ps s, &ast::ty ty) {
227
224
fn get_span ( & ast:: ty_field f) -> common:: span {
228
225
ret f. span ;
229
226
}
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) ;
233
228
pclose ( s) ;
234
229
}
235
230
case ( ast:: ty_obj ( ?methods) ) {
@@ -346,13 +341,12 @@ fn print_item(&ps s, &@ast::item item) {
346
341
space ( s. s ) ;
347
342
maybe_print_comment ( s, v. span . lo ) ;
348
343
word ( s. s , v. node . name ) ;
349
- if ( vec:: len[ ast :: variant_arg ] ( v. node . args ) > 0 u) {
344
+ if ( vec:: len ( v. node . args ) > 0 u) {
350
345
popen ( s) ;
351
346
fn print_variant_arg ( & ps s, & ast:: variant_arg arg) {
352
347
print_type ( s, * arg. ty ) ;
353
348
}
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) ;
356
350
pclose ( s) ;
357
351
}
358
352
word ( s. s , ";" ) ;
@@ -373,9 +367,7 @@ fn print_item(&ps s, &@ast::item item) {
373
367
end ( s) ;
374
368
}
375
369
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) ;
379
371
pclose ( s) ;
380
372
space ( s. s ) ;
381
373
bopen ( s) ;
@@ -488,9 +480,7 @@ fn print_expr(&ps s, &@ast::expr expr) {
488
480
fn get_span ( & ast:: elt elt) -> common:: span { ret elt. expr . span ; }
489
481
word ( s. s , "tup" ) ;
490
482
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) ;
494
484
pclose ( s) ;
495
485
}
496
486
case ( ast:: expr_rec ( ?fields, ?wth, _) ) {
@@ -507,12 +497,10 @@ fn print_expr(&ps s, &@ast::expr expr) {
507
497
}
508
498
word ( s. s , "rec" ) ;
509
499
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) ;
513
501
alt ( wth) {
514
502
case ( some ( ?expr) ) {
515
- if ( vec:: len[ ast :: field ] ( fields) > 0 u) { space ( s. s ) ; }
503
+ if ( vec:: len ( fields) > 0 u) { space ( s. s ) ; }
516
504
ibox ( s, indent_unit) ;
517
505
word_space ( s, "with" ) ;
518
506
print_expr ( s, expr) ;
@@ -544,8 +532,7 @@ fn print_expr(&ps s, &@ast::expr expr) {
544
532
word_nbsp ( s, "bind" ) ;
545
533
print_expr ( s, func) ;
546
534
popen ( s) ;
547
- auto f = print_opt;
548
- commasep[ option:: t[ @ast:: expr] ] ( s, inconsistent, args, f) ;
535
+ commasep ( s, inconsistent, args, print_opt) ;
549
536
pclose ( s) ;
550
537
}
551
538
case ( ast:: expr_spawn ( _, _, ?e, ?es, _) ) {
@@ -792,7 +779,7 @@ fn print_expr(&ps s, &@ast::expr expr) {
792
779
case ( ast:: expr_ext ( ?path, ?args, ?body, _, _) ) {
793
780
word ( s. s , "#" ) ;
794
781
print_path ( s, path) ;
795
- if ( vec:: len[ @ast :: expr ] ( args) > 0 u) {
782
+ if ( vec:: len ( args) > 0 u) {
796
783
popen ( s) ;
797
784
commasep_exprs ( s, inconsistent, args) ;
798
785
pclose ( s) ;
@@ -896,7 +883,7 @@ fn print_ident(&ps s, &ast::ident ident) {
896
883
}
897
884
898
885
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 ) ) ;
900
887
space ( s. s ) ;
901
888
word ( s. s , loc. node . ident ) ;
902
889
}
@@ -909,10 +896,9 @@ fn print_path(&ps s, &ast::path path) {
909
896
else { word ( s. s , "::" ) ; }
910
897
word ( s. s , id) ;
911
898
}
912
- if ( vec:: len[ @ast :: ty ] ( path. node . types ) > 0 u) {
899
+ if ( vec:: len ( path. node . types ) > 0 u) {
913
900
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) ;
916
902
word ( s. s , "]" ) ;
917
903
}
918
904
}
@@ -925,10 +911,9 @@ fn print_pat(&ps s, &@ast::pat pat) {
925
911
case ( ast:: pat_lit ( ?lit, _) ) { print_literal ( s, lit) ; }
926
912
case ( ast:: pat_tag ( ?path, ?args, _) ) {
927
913
print_path ( s, path) ;
928
- if ( vec:: len[ @ast :: pat ] ( args) > 0 u) {
914
+ if ( vec:: len ( args) > 0 u) {
929
915
popen ( s) ;
930
- auto f = print_pat;
931
- commasep[ @ast:: pat] ( s, inconsistent, args, f) ;
916
+ commasep ( s, inconsistent, args, print_pat) ;
932
917
pclose ( s) ;
933
918
}
934
919
}
@@ -973,7 +958,7 @@ fn print_fn_args_and_ret(&ps s, &ast::fn_decl decl) {
973
958
word ( s. s , x. ident ) ;
974
959
end ( s) ;
975
960
}
976
- commasep[ ast :: arg ] ( s, inconsistent, decl. inputs , print_arg) ;
961
+ commasep ( s, inconsistent, decl. inputs , print_arg) ;
977
962
pclose ( s) ;
978
963
maybe_print_comment ( s, decl. output . span . lo ) ;
979
964
if ( decl. output . node != ast:: ty_nil) {
@@ -992,13 +977,12 @@ fn print_alias(&ps s, ast::mode m) {
992
977
}
993
978
994
979
fn print_type_params ( & ps s, & vec[ ast:: ty_param ] params ) {
995
- if ( vec:: len[ ast :: ty_param ] ( params) > 0 u) {
980
+ if ( vec:: len ( params) > 0 u) {
996
981
word ( s. s , "[" ) ;
997
982
fn printParam ( & ps s, & ast:: ty_param param) {
998
983
word ( s. s , param) ;
999
984
}
1000
- auto f = printParam;
1001
- commasep[ ast:: ty_param] ( s, inconsistent, params, f) ;
985
+ commasep ( s, inconsistent, params, printParam) ;
1002
986
word ( s. s , "]" ) ;
1003
987
}
1004
988
}
@@ -1010,7 +994,7 @@ fn print_view_item(&ps s, &@ast::view_item item) {
1010
994
case ( ast:: view_item_use ( ?id, ?mta, _, _) ) {
1011
995
head ( s, "use" ) ;
1012
996
word ( s. s , id) ;
1013
- if ( vec:: len[ @ast :: meta_item ] ( mta) > 0 u) {
997
+ if ( vec:: len ( mta) > 0 u) {
1014
998
popen ( s) ;
1015
999
fn print_meta ( & ps s, & @ast:: meta_item item) {
1016
1000
ibox ( s, indent_unit) ;
@@ -1019,14 +1003,13 @@ fn print_view_item(&ps s, &@ast::view_item item) {
1019
1003
print_string ( s, item. node . value ) ;
1020
1004
end ( s) ;
1021
1005
}
1022
- auto f = print_meta;
1023
- commasep[ @ast:: meta_item] ( s, consistent, mta, f) ;
1006
+ commasep ( s, consistent, mta, print_meta) ;
1024
1007
pclose ( s) ;
1025
1008
}
1026
1009
}
1027
1010
case ( ast:: view_item_import ( ?id, ?ids, _) ) {
1028
1011
head ( s, "import" ) ;
1029
- if ( !str:: eq ( id, ids. ( vec:: len[ str ] ( ids) -1 u) ) ) {
1012
+ if ( !str:: eq ( id, ids. ( vec:: len ( ids) -1 u) ) ) {
1030
1013
word_space ( s, id) ;
1031
1014
word_space ( s, "=" ) ;
1032
1015
}
@@ -1112,8 +1095,7 @@ fn print_ty_fn(&ps s, &ast::proto proto, &option::t[str] id,
1112
1095
print_alias ( s, input. node . mode ) ;
1113
1096
print_type ( s, * input. node . ty ) ;
1114
1097
}
1115
- auto f = print_arg;
1116
- commasep[ ast:: ty_arg] ( s, inconsistent, inputs, f) ;
1098
+ commasep ( s, inconsistent, inputs, print_arg) ;
1117
1099
pclose ( s) ;
1118
1100
maybe_print_comment ( s, output. span . lo ) ;
1119
1101
if ( output. node != ast:: ty_nil) {
0 commit comments