@@ -80,8 +80,6 @@ use parse::{new_sub_parser_from_file, ParseSess};
80
80
use opt_vec;
81
81
use opt_vec:: OptVec ;
82
82
83
- use std:: either:: Either ;
84
- use std:: either;
85
83
use std:: hashmap:: HashSet ;
86
84
use std:: util;
87
85
use std:: vec;
@@ -94,7 +92,6 @@ enum restriction {
94
92
RESTRICT_NO_BAR_OR_DOUBLEBAR_OP ,
95
93
}
96
94
97
- type arg_or_capture_item = Either < arg , ( ) > ;
98
95
type item_info = ( Ident , item_ , Option < ~[ Attribute ] > ) ;
99
96
100
97
/// How to parse a path. There are four different kinds of paths, all of which
@@ -936,7 +933,7 @@ impl Parser {
936
933
let ( explicit_self, d) = do self . parse_fn_decl_with_self ( ) |p| {
937
934
// This is somewhat dubious; We don't want to allow argument
938
935
// names to be left off if there is a definition...
939
- either :: Left ( p. parse_arg_general ( false ) )
936
+ p. parse_arg_general ( false )
940
937
} ;
941
938
942
939
let hi = p. last_span . hi ;
@@ -1290,12 +1287,12 @@ impl Parser {
1290
1287
}
1291
1288
1292
1289
// parse a single function argument
1293
- pub fn parse_arg ( & self ) -> arg_or_capture_item {
1294
- either :: Left ( self . parse_arg_general ( true ) )
1290
+ pub fn parse_arg ( & self ) -> arg {
1291
+ self . parse_arg_general ( true )
1295
1292
}
1296
1293
1297
1294
// parse an argument in a lambda header e.g. |arg, arg|
1298
- pub fn parse_fn_block_arg ( & self ) -> arg_or_capture_item {
1295
+ pub fn parse_fn_block_arg ( & self ) -> arg {
1299
1296
self . parse_arg_mode ( ) ;
1300
1297
let is_mutbl = self . eat_keyword ( keywords:: Mut ) ;
1301
1298
let pat = self . parse_pat ( ) ;
@@ -1308,12 +1305,12 @@ impl Parser {
1308
1305
span : mk_sp ( self . span . lo , self . span . hi ) ,
1309
1306
}
1310
1307
} ;
1311
- either :: Left ( ast:: arg {
1308
+ ast:: arg {
1312
1309
is_mutbl : is_mutbl,
1313
1310
ty : t,
1314
1311
pat : pat,
1315
1312
id : ast:: DUMMY_NODE_ID
1316
- } )
1313
+ }
1317
1314
}
1318
1315
1319
1316
pub fn maybe_parse_fixed_vstore ( & self ) -> Option < @ast:: Expr > {
@@ -3500,19 +3497,17 @@ impl Parser {
3500
3497
3501
3498
// parse the argument list and result type of a function declaration
3502
3499
pub fn parse_fn_decl ( & self ) -> fn_decl {
3503
- let args_or_capture_items : ~[ arg_or_capture_item ] =
3500
+ let args : ~[ arg ] =
3504
3501
self . parse_unspanned_seq (
3505
3502
& token:: LPAREN ,
3506
3503
& token:: RPAREN ,
3507
3504
seq_sep_trailing_disallowed ( token:: COMMA ) ,
3508
3505
|p| p. parse_arg ( )
3509
3506
) ;
3510
3507
3511
- let inputs = either:: lefts ( args_or_capture_items. move_iter ( ) ) . collect ( ) ;
3512
-
3513
3508
let ( ret_style, ret_ty) = self . parse_ret_ty ( ) ;
3514
3509
ast:: fn_decl {
3515
- inputs : inputs ,
3510
+ inputs : args ,
3516
3511
output : ret_ty,
3517
3512
cf : ret_style,
3518
3513
}
@@ -3542,7 +3537,7 @@ impl Parser {
3542
3537
fn parse_fn_decl_with_self (
3543
3538
& self ,
3544
3539
parse_arg_fn :
3545
- & fn ( & Parser ) -> arg_or_capture_item
3540
+ & fn ( & Parser ) -> arg
3546
3541
) -> ( explicit_self , fn_decl ) {
3547
3542
fn maybe_parse_explicit_self (
3548
3543
cnstr : & fn ( v : Mutability ) -> ast:: explicit_self_ ,
@@ -3650,20 +3645,20 @@ impl Parser {
3650
3645
} ;
3651
3646
3652
3647
// If we parsed a self type, expect a comma before the argument list.
3653
- let args_or_capture_items ;
3648
+ let fn_inputs ;
3654
3649
if explicit_self != sty_static {
3655
3650
match * self . token {
3656
3651
token:: COMMA => {
3657
3652
self . bump ( ) ;
3658
3653
let sep = seq_sep_trailing_disallowed ( token:: COMMA ) ;
3659
- args_or_capture_items = self . parse_seq_to_before_end (
3654
+ fn_inputs = self . parse_seq_to_before_end (
3660
3655
& token:: RPAREN ,
3661
3656
sep,
3662
3657
parse_arg_fn
3663
3658
) ;
3664
3659
}
3665
3660
token:: RPAREN => {
3666
- args_or_capture_items = ~[ ] ;
3661
+ fn_inputs = ~[ ] ;
3667
3662
}
3668
3663
_ => {
3669
3664
self . fatal (
@@ -3676,7 +3671,7 @@ impl Parser {
3676
3671
}
3677
3672
} else {
3678
3673
let sep = seq_sep_trailing_disallowed ( token:: COMMA ) ;
3679
- args_or_capture_items = self . parse_seq_to_before_end (
3674
+ fn_inputs = self . parse_seq_to_before_end (
3680
3675
& token:: RPAREN ,
3681
3676
sep,
3682
3677
parse_arg_fn
@@ -3687,11 +3682,10 @@ impl Parser {
3687
3682
3688
3683
let hi = self . span . hi ;
3689
3684
3690
- let inputs = either:: lefts ( args_or_capture_items. move_iter ( ) ) . collect ( ) ;
3691
3685
let ( ret_style, ret_ty) = self . parse_ret_ty ( ) ;
3692
3686
3693
3687
let fn_decl = ast:: fn_decl {
3694
- inputs : inputs ,
3688
+ inputs : fn_inputs ,
3695
3689
output : ret_ty,
3696
3690
cf : ret_style
3697
3691
} ;
@@ -3720,7 +3714,7 @@ impl Parser {
3720
3714
} ;
3721
3715
3722
3716
ast:: fn_decl {
3723
- inputs : either :: lefts ( inputs_captures. move_iter ( ) ) . collect ( ) ,
3717
+ inputs : inputs_captures,
3724
3718
output : output,
3725
3719
cf : return_val,
3726
3720
}
0 commit comments