@@ -703,14 +703,11 @@ impl<'a> State<'a> {
703
703
predicates : Vec :: new ( ) ,
704
704
} ,
705
705
} ;
706
- try!( self . print_ty_fn ( Some ( f. abi ) ,
707
- None ,
706
+ try!( self . print_ty_fn ( f. abi ,
708
707
f. unsafety ,
709
- ast:: Many ,
710
708
& * f. decl ,
711
709
None ,
712
- & OwnedSlice :: empty ( ) ,
713
- Some ( & generics) ,
710
+ & generics,
714
711
None ) ) ;
715
712
}
716
713
ast:: TyPath ( ref path, _) => {
@@ -1215,14 +1212,11 @@ impl<'a> State<'a> {
1215
1212
try!( self . hardbreak_if_not_bol ( ) ) ;
1216
1213
try!( self . maybe_print_comment ( m. span . lo ) ) ;
1217
1214
try!( self . print_outer_attributes ( & m. attrs [ ] ) ) ;
1218
- try!( self . print_ty_fn ( None ,
1219
- None ,
1215
+ try!( self . print_ty_fn ( m. abi ,
1220
1216
m. unsafety ,
1221
- ast:: Many ,
1222
1217
& * m. decl ,
1223
1218
Some ( m. ident ) ,
1224
- & OwnedSlice :: empty ( ) ,
1225
- Some ( & m. generics ) ,
1219
+ & m. generics ,
1226
1220
Some ( & m. explicit_self . node ) ) ) ;
1227
1221
word ( & mut self . s , ";" )
1228
1222
}
@@ -2300,7 +2294,7 @@ impl<'a> State<'a> {
2300
2294
opt_explicit_self : Option < & ast:: ExplicitSelf_ > ,
2301
2295
vis : ast:: Visibility ) -> IoResult < ( ) > {
2302
2296
try!( self . head ( "" ) ) ;
2303
- try!( self . print_fn_header_info ( opt_explicit_self , unsafety, abi, vis) ) ;
2297
+ try!( self . print_fn_header_info ( unsafety, abi, vis) ) ;
2304
2298
try!( self . nbsp ( ) ) ;
2305
2299
try!( self . print_ident ( name) ) ;
2306
2300
try!( self . print_generics ( generics) ) ;
@@ -2396,31 +2390,6 @@ impl<'a> State<'a> {
2396
2390
}
2397
2391
}
2398
2392
2399
- pub fn print_proc_args ( & mut self , decl : & ast:: FnDecl ) -> IoResult < ( ) > {
2400
- try!( word ( & mut self . s , "proc" ) ) ;
2401
- try!( word ( & mut self . s , "(" ) ) ;
2402
- try!( self . print_fn_args ( decl, None ) ) ;
2403
- try!( word ( & mut self . s , ")" ) ) ;
2404
-
2405
- if let ast:: DefaultReturn ( ..) = decl. output {
2406
- return Ok ( ( ) ) ;
2407
- }
2408
-
2409
- try!( self . space_if_not_bol ( ) ) ;
2410
- try!( self . word_space ( "->" ) ) ;
2411
- match decl. output {
2412
- ast:: Return ( ref ty) => {
2413
- try!( self . print_type ( & * * ty) ) ;
2414
- self . maybe_print_comment ( ty. span . lo )
2415
- }
2416
- ast:: DefaultReturn ( ..) => unreachable ! ( ) ,
2417
- ast:: NoReturn ( span) => {
2418
- try!( self . word_nbsp ( "!" ) ) ;
2419
- self . maybe_print_comment ( span. lo )
2420
- }
2421
- }
2422
- }
2423
-
2424
2393
pub fn print_bounds ( & mut self ,
2425
2394
prefix : & str ,
2426
2395
bounds : & [ ast:: TyParamBound ] )
@@ -2696,31 +2665,15 @@ impl<'a> State<'a> {
2696
2665
}
2697
2666
2698
2667
pub fn print_ty_fn ( & mut self ,
2699
- opt_abi : Option < abi:: Abi > ,
2700
- opt_sigil : Option < char > ,
2668
+ abi : abi:: Abi ,
2701
2669
unsafety : ast:: Unsafety ,
2702
- onceness : ast:: Onceness ,
2703
2670
decl : & ast:: FnDecl ,
2704
2671
id : Option < ast:: Ident > ,
2705
- bounds : & OwnedSlice < ast:: TyParamBound > ,
2706
- generics : Option < & ast:: Generics > ,
2672
+ generics : & ast:: Generics ,
2707
2673
opt_explicit_self : Option < & ast:: ExplicitSelf_ > )
2708
2674
-> IoResult < ( ) > {
2709
2675
try!( self . ibox ( indent_unit) ) ;
2710
-
2711
- // Duplicates the logic in `print_fn_header_info()`. This is because that
2712
- // function prints the sigil in the wrong place. That should be fixed.
2713
- if opt_sigil == Some ( '~' ) && onceness == ast:: Once {
2714
- try!( word ( & mut self . s , "proc" ) ) ;
2715
- } else if opt_sigil == Some ( '&' ) {
2716
- try!( self . print_unsafety ( unsafety) ) ;
2717
- try!( self . print_extern_opt_abi ( opt_abi) ) ;
2718
- } else {
2719
- assert ! ( opt_sigil. is_none( ) ) ;
2720
- try!( self . print_unsafety ( unsafety) ) ;
2721
- try!( self . print_opt_abi_and_extern_if_nondefault ( opt_abi) ) ;
2722
- try!( word ( & mut self . s , "fn" ) ) ;
2723
- }
2676
+ try!( self . print_fn_header_info ( Some ( unsafety) , abi, ast:: Inherited ) ) ;
2724
2677
2725
2678
match id {
2726
2679
Some ( id) => {
@@ -2730,35 +2683,10 @@ impl<'a> State<'a> {
2730
2683
_ => ( )
2731
2684
}
2732
2685
2733
- match generics { Some ( g ) => try!( self . print_generics ( g ) ) , _ => ( ) }
2686
+ try!( self . print_generics ( generics ) ) ;
2734
2687
try!( zerobreak ( & mut self . s ) ) ;
2735
-
2736
- if opt_sigil == Some ( '&' ) {
2737
- try!( word ( & mut self . s , "|" ) ) ;
2738
- } else {
2739
- try!( self . popen ( ) ) ;
2740
- }
2741
-
2742
- try!( self . print_fn_args ( decl, opt_explicit_self) ) ;
2743
-
2744
- if opt_sigil == Some ( '&' ) {
2745
- try!( word ( & mut self . s , "|" ) ) ;
2746
- } else {
2747
- if decl. variadic {
2748
- try!( word ( & mut self . s , ", ..." ) ) ;
2749
- }
2750
- try!( self . pclose ( ) ) ;
2751
- }
2752
-
2753
- try!( self . print_bounds ( ":" , & bounds[ ] ) ) ;
2754
-
2755
- try!( self . print_fn_output ( decl) ) ;
2756
-
2757
- match generics {
2758
- Some ( generics) => try!( self . print_where_clause ( generics) ) ,
2759
- None => { }
2760
- }
2761
-
2688
+ try!( self . print_fn_args_and_ret ( decl, opt_explicit_self) ) ;
2689
+ try!( self . print_where_clause ( generics) ) ;
2762
2690
self . end ( )
2763
2691
}
2764
2692
@@ -3015,7 +2943,6 @@ impl<'a> State<'a> {
3015
2943
}
3016
2944
3017
2945
pub fn print_fn_header_info ( & mut self ,
3018
- _opt_explicit_self : Option < & ast:: ExplicitSelf_ > ,
3019
2946
opt_unsafety : Option < ast:: Unsafety > ,
3020
2947
abi : abi:: Abi ,
3021
2948
vis : ast:: Visibility ) -> IoResult < ( ) > {
0 commit comments