@@ -261,19 +261,19 @@ struct CaptureState {
261261
262262/// A sequence separator.
263263#[ derive( Debug ) ]
264- struct SeqSep < ' a > {
264+ struct SeqSep {
265265 /// The separator token.
266- sep : Option < ExpTokenPair < ' a > > ,
266+ sep : Option < ExpTokenPair > ,
267267 /// `true` if a trailing separator is allowed.
268268 trailing_sep_allowed : bool ,
269269}
270270
271- impl < ' a > SeqSep < ' a > {
272- fn trailing_allowed ( sep : ExpTokenPair < ' a > ) -> SeqSep < ' a > {
271+ impl SeqSep {
272+ fn trailing_allowed ( sep : ExpTokenPair ) -> SeqSep {
273273 SeqSep { sep : Some ( sep) , trailing_sep_allowed : true }
274274 }
275275
276- fn none ( ) -> SeqSep < ' a > {
276+ fn none ( ) -> SeqSep {
277277 SeqSep { sep : None , trailing_sep_allowed : false }
278278 }
279279}
@@ -425,13 +425,13 @@ impl<'a> Parser<'a> {
425425 }
426426
427427 /// Expects and consumes the token `t`. Signals an error if the next token is not `t`.
428- pub fn expect ( & mut self , exp : ExpTokenPair < ' _ > ) -> PResult < ' a , Recovered > {
428+ pub fn expect ( & mut self , exp : ExpTokenPair ) -> PResult < ' a , Recovered > {
429429 if self . expected_token_types . is_empty ( ) {
430- if self . token == * exp. tok {
430+ if self . token == exp. tok {
431431 self . bump ( ) ;
432432 Ok ( Recovered :: No )
433433 } else {
434- self . unexpected_try_recover ( exp. tok )
434+ self . unexpected_try_recover ( & exp. tok )
435435 }
436436 } else {
437437 self . expect_one_of ( slice:: from_ref ( & exp) , & [ ] )
@@ -443,13 +443,13 @@ impl<'a> Parser<'a> {
443443 /// anything. Signal a fatal error if next token is unexpected.
444444 fn expect_one_of (
445445 & mut self ,
446- edible : & [ ExpTokenPair < ' _ > ] ,
447- inedible : & [ ExpTokenPair < ' _ > ] ,
446+ edible : & [ ExpTokenPair ] ,
447+ inedible : & [ ExpTokenPair ] ,
448448 ) -> PResult < ' a , Recovered > {
449- if edible. iter ( ) . any ( |exp| exp. tok == & self . token . kind ) {
449+ if edible. iter ( ) . any ( |exp| exp. tok == self . token . kind ) {
450450 self . bump ( ) ;
451451 Ok ( Recovered :: No )
452- } else if inedible. iter ( ) . any ( |exp| exp. tok == & self . token . kind ) {
452+ } else if inedible. iter ( ) . any ( |exp| exp. tok == self . token . kind ) {
453453 // leave it in the input
454454 Ok ( Recovered :: No )
455455 } else if self . token != token:: Eof
@@ -494,8 +494,8 @@ impl<'a> Parser<'a> {
494494 /// This method will automatically add `tok` to `expected_token_types` if `tok` is not
495495 /// encountered.
496496 #[ inline]
497- pub fn check ( & mut self , exp : ExpTokenPair < ' _ > ) -> bool {
498- let is_present = self . token == * exp. tok ;
497+ pub fn check ( & mut self , exp : ExpTokenPair ) -> bool {
498+ let is_present = self . token == exp. tok ;
499499 if !is_present {
500500 self . expected_token_types . insert ( exp. token_type ) ;
501501 }
@@ -542,7 +542,7 @@ impl<'a> Parser<'a> {
542542 /// Consumes a token 'tok' if it exists. Returns whether the given token was present.
543543 #[ inline]
544544 #[ must_use]
545- pub fn eat ( & mut self , exp : ExpTokenPair < ' _ > ) -> bool {
545+ pub fn eat ( & mut self , exp : ExpTokenPair ) -> bool {
546546 let is_present = self . check ( exp) ;
547547 if is_present {
548548 self . bump ( )
@@ -745,13 +745,13 @@ impl<'a> Parser<'a> {
745745 /// Eats the expected token if it's present possibly breaking
746746 /// compound tokens like multi-character operators in process.
747747 /// Returns `true` if the token was eaten.
748- fn break_and_eat ( & mut self , exp : ExpTokenPair < ' _ > ) -> bool {
749- if self . token == * exp. tok {
748+ fn break_and_eat ( & mut self , exp : ExpTokenPair ) -> bool {
749+ if self . token == exp. tok {
750750 self . bump ( ) ;
751751 return true ;
752752 }
753753 match self . token . kind . break_two_token_op ( 1 ) {
754- Some ( ( first, second) ) if first == * exp. tok => {
754+ Some ( ( first, second) ) if first == exp. tok => {
755755 let first_span = self . psess . source_map ( ) . start_point ( self . token . span ) ;
756756 let second_span = self . token . span . with_lo ( first_span. hi ( ) ) ;
757757 self . token = Token :: new ( first, first_span) ;
@@ -826,7 +826,7 @@ impl<'a> Parser<'a> {
826826 /// Checks if the next token is contained within `closes`, and returns `true` if so.
827827 fn expect_any_with_type (
828828 & mut self ,
829- closes_expected : & [ ExpTokenPair < ' _ > ] ,
829+ closes_expected : & [ ExpTokenPair ] ,
830830 closes_not_expected : & [ & TokenKind ] ,
831831 ) -> bool {
832832 closes_expected. iter ( ) . any ( |& close| self . check ( close) )
@@ -838,9 +838,9 @@ impl<'a> Parser<'a> {
838838 /// closing bracket.
839839 fn parse_seq_to_before_tokens < T > (
840840 & mut self ,
841- closes_expected : & [ ExpTokenPair < ' _ > ] ,
841+ closes_expected : & [ ExpTokenPair ] ,
842842 closes_not_expected : & [ & TokenKind ] ,
843- sep : SeqSep < ' _ > ,
843+ sep : SeqSep ,
844844 mut f : impl FnMut ( & mut Parser < ' a > ) -> PResult < ' a , T > ,
845845 ) -> PResult < ' a , ( ThinVec < T > , Trailing , Recovered ) > {
846846 let mut first = true ;
@@ -869,7 +869,7 @@ impl<'a> Parser<'a> {
869869 }
870870 Err ( mut expect_err) => {
871871 let sp = self . prev_token . span . shrink_to_hi ( ) ;
872- let token_str = pprust:: token_kind_to_string ( exp. tok ) ;
872+ let token_str = pprust:: token_kind_to_string ( & exp. tok ) ;
873873
874874 match self . current_closure . take ( ) {
875875 Some ( closure_spans) if self . token == TokenKind :: Semi => {
@@ -1039,8 +1039,8 @@ impl<'a> Parser<'a> {
10391039 /// closing bracket.
10401040 fn parse_seq_to_before_end < T > (
10411041 & mut self ,
1042- close : ExpTokenPair < ' _ > ,
1043- sep : SeqSep < ' _ > ,
1042+ close : ExpTokenPair ,
1043+ sep : SeqSep ,
10441044 f : impl FnMut ( & mut Parser < ' a > ) -> PResult < ' a , T > ,
10451045 ) -> PResult < ' a , ( ThinVec < T > , Trailing , Recovered ) > {
10461046 self . parse_seq_to_before_tokens ( & [ close] , & [ ] , sep, f)
@@ -1051,8 +1051,8 @@ impl<'a> Parser<'a> {
10511051 /// closing bracket.
10521052 fn parse_seq_to_end < T > (
10531053 & mut self ,
1054- close : ExpTokenPair < ' _ > ,
1055- sep : SeqSep < ' _ > ,
1054+ close : ExpTokenPair ,
1055+ sep : SeqSep ,
10561056 f : impl FnMut ( & mut Parser < ' a > ) -> PResult < ' a , T > ,
10571057 ) -> PResult < ' a , ( ThinVec < T > , Trailing ) > {
10581058 let ( val, trailing, recovered) = self . parse_seq_to_before_end ( close, sep, f) ?;
@@ -1070,9 +1070,9 @@ impl<'a> Parser<'a> {
10701070 /// closing bracket.
10711071 fn parse_unspanned_seq < T > (
10721072 & mut self ,
1073- open : ExpTokenPair < ' _ > ,
1074- close : ExpTokenPair < ' _ > ,
1075- sep : SeqSep < ' _ > ,
1073+ open : ExpTokenPair ,
1074+ close : ExpTokenPair ,
1075+ sep : SeqSep ,
10761076 f : impl FnMut ( & mut Parser < ' a > ) -> PResult < ' a , T > ,
10771077 ) -> PResult < ' a , ( ThinVec < T > , Trailing ) > {
10781078 self . expect ( open) ?;
@@ -1084,8 +1084,8 @@ impl<'a> Parser<'a> {
10841084 /// closing bracket.
10851085 fn parse_delim_comma_seq < T > (
10861086 & mut self ,
1087- open : ExpTokenPair < ' _ > ,
1088- close : ExpTokenPair < ' _ > ,
1087+ open : ExpTokenPair ,
1088+ close : ExpTokenPair ,
10891089 f : impl FnMut ( & mut Parser < ' a > ) -> PResult < ' a , T > ,
10901090 ) -> PResult < ' a , ( ThinVec < T > , Trailing ) > {
10911091 self . parse_unspanned_seq ( open, close, SeqSep :: trailing_allowed ( exp ! ( Comma ) ) , f)
0 commit comments