@@ -1310,7 +1310,7 @@ impl<'a> Parser<'a> {
1310
1310
let ident = p. parse_ident ( ) ?;
1311
1311
let mut generics = p. parse_generics ( ) ?;
1312
1312
1313
- let ( d , self_shortcut ) = p. parse_fn_decl_with_self ( |p : & mut Parser < ' a > |{
1313
+ let d = p. parse_fn_decl_with_self ( |p : & mut Parser < ' a > |{
1314
1314
// This is somewhat dubious; We don't want to allow
1315
1315
// argument names to be left off if there is a
1316
1316
// definition...
@@ -1324,7 +1324,6 @@ impl<'a> Parser<'a> {
1324
1324
decl : d,
1325
1325
generics : generics,
1326
1326
abi : abi,
1327
- self_shortcut : self_shortcut,
1328
1327
} ;
1329
1328
1330
1329
let body = match p. token {
@@ -4617,7 +4616,7 @@ impl<'a> Parser<'a> {
4617
4616
}
4618
4617
4619
4618
/// Returns the parsed optional self argument and whether a self shortcut was used.
4620
- fn parse_self_arg ( & mut self ) -> PResult < ' a , ( Option < Arg > , bool ) > {
4619
+ fn parse_self_arg ( & mut self ) -> PResult < ' a , Option < Arg > > {
4621
4620
let expect_ident = |this : & mut Self | match this. token {
4622
4621
// Preserve hygienic context.
4623
4622
token:: Ident ( ident) => { this. bump ( ) ; codemap:: respan ( this. last_span , ident) }
@@ -4656,7 +4655,7 @@ impl<'a> Parser<'a> {
4656
4655
self . bump ( ) ;
4657
4656
( SelfKind :: Region ( Some ( lt) , Mutability :: Mutable ) , expect_ident ( self ) )
4658
4657
} else {
4659
- return Ok ( ( None , false ) ) ;
4658
+ return Ok ( None ) ;
4660
4659
}
4661
4660
}
4662
4661
token:: BinOp ( token:: Star ) => {
@@ -4676,7 +4675,7 @@ impl<'a> Parser<'a> {
4676
4675
self . span_err ( self . span , "cannot pass `self` by raw pointer" ) ;
4677
4676
( SelfKind :: Value ( Mutability :: Immutable ) , expect_ident ( self ) )
4678
4677
} else {
4679
- return Ok ( ( None , false ) ) ;
4678
+ return Ok ( None ) ;
4680
4679
}
4681
4680
}
4682
4681
token:: Ident ( ..) => {
@@ -4703,27 +4702,24 @@ impl<'a> Parser<'a> {
4703
4702
( SelfKind :: Value ( Mutability :: Mutable ) , eself_ident)
4704
4703
}
4705
4704
} else {
4706
- return Ok ( ( None , false ) ) ;
4705
+ return Ok ( None ) ;
4707
4706
}
4708
4707
}
4709
- _ => return Ok ( ( None , false ) ) ,
4708
+ _ => return Ok ( None ) ,
4710
4709
} ;
4711
4710
4712
- let self_shortcut = if let SelfKind :: Explicit ( ..) = eself { false } else { true } ;
4713
4711
let eself = codemap:: respan ( mk_sp ( eself_lo, self . last_span . hi ) , eself) ;
4714
- Ok ( ( Some ( Arg :: from_self ( eself, eself_ident) ) , self_shortcut ) )
4712
+ Ok ( Some ( Arg :: from_self ( eself, eself_ident) ) )
4715
4713
}
4716
4714
4717
4715
/// Parse the parameter list and result type of a function that may have a `self` parameter.
4718
- fn parse_fn_decl_with_self < F > ( & mut self ,
4719
- parse_arg_fn : F )
4720
- -> PResult < ' a , ( P < FnDecl > , bool ) >
4716
+ fn parse_fn_decl_with_self < F > ( & mut self , parse_arg_fn : F ) -> PResult < ' a , P < FnDecl > >
4721
4717
where F : FnMut ( & mut Parser < ' a > ) -> PResult < ' a , Arg > ,
4722
4718
{
4723
4719
self . expect ( & token:: OpenDelim ( token:: Paren ) ) ?;
4724
4720
4725
4721
// Parse optional self argument
4726
- let ( self_arg, self_shortcut ) = self . parse_self_arg ( ) ?;
4722
+ let self_arg = self . parse_self_arg ( ) ?;
4727
4723
4728
4724
// Parse the rest of the function parameter list.
4729
4725
let sep = SeqSep :: trailing_allowed ( token:: Comma ) ;
@@ -4745,11 +4741,11 @@ impl<'a> Parser<'a> {
4745
4741
4746
4742
// Parse closing paren and return type.
4747
4743
self . expect ( & token:: CloseDelim ( token:: Paren ) ) ?;
4748
- Ok ( ( P ( FnDecl {
4744
+ Ok ( P ( FnDecl {
4749
4745
inputs : fn_inputs,
4750
4746
output : self . parse_ret_ty ( ) ?,
4751
4747
variadic : false
4752
- } ) , self_shortcut ) )
4748
+ } ) )
4753
4749
}
4754
4750
4755
4751
// parse the |arg, arg| header on a lambda
@@ -4942,13 +4938,12 @@ impl<'a> Parser<'a> {
4942
4938
let ( constness, unsafety, abi) = self . parse_fn_front_matter ( ) ?;
4943
4939
let ident = self . parse_ident ( ) ?;
4944
4940
let mut generics = self . parse_generics ( ) ?;
4945
- let ( decl, self_shortcut ) = self . parse_fn_decl_with_self ( |p| p. parse_arg ( ) ) ?;
4941
+ let decl = self . parse_fn_decl_with_self ( |p| p. parse_arg ( ) ) ?;
4946
4942
generics. where_clause = self . parse_where_clause ( ) ?;
4947
4943
let ( inner_attrs, body) = self . parse_inner_attrs_and_block ( ) ?;
4948
4944
Ok ( ( ident, inner_attrs, ast:: ImplItemKind :: Method ( ast:: MethodSig {
4949
4945
generics : generics,
4950
4946
abi : abi,
4951
- self_shortcut : self_shortcut,
4952
4947
unsafety : unsafety,
4953
4948
constness : constness,
4954
4949
decl : decl
0 commit comments