@@ -371,6 +371,12 @@ impl From<Recovered> for bool {
371371 }
372372}
373373
374+ #[ derive( Copy , Clone , Debug ) ]
375+ pub enum Trailing {
376+ No ,
377+ Yes ,
378+ }
379+
374380#[ derive( Clone , Copy , PartialEq , Eq ) ]
375381pub enum TokenDescription {
376382 ReservedIdentifier ,
@@ -797,10 +803,10 @@ impl<'a> Parser<'a> {
797803 sep : SeqSep ,
798804 expect : TokenExpectType ,
799805 mut f : impl FnMut ( & mut Parser < ' a > ) -> PResult < ' a , T > ,
800- ) -> PResult < ' a , ( ThinVec < T > , bool /* trailing */ , Recovered ) > {
806+ ) -> PResult < ' a , ( ThinVec < T > , Trailing , Recovered ) > {
801807 let mut first = true ;
802808 let mut recovered = Recovered :: No ;
803- let mut trailing = false ;
809+ let mut trailing = Trailing :: No ;
804810 let mut v = ThinVec :: new ( ) ;
805811
806812 while !self . expect_any_with_type ( kets, expect) {
@@ -914,7 +920,7 @@ impl<'a> Parser<'a> {
914920 }
915921 }
916922 if sep. trailing_sep_allowed && self . expect_any_with_type ( kets, expect) {
917- trailing = true ;
923+ trailing = Trailing :: Yes ;
918924 break ;
919925 }
920926
@@ -992,7 +998,7 @@ impl<'a> Parser<'a> {
992998 ket : & TokenKind ,
993999 sep : SeqSep ,
9941000 f : impl FnMut ( & mut Parser < ' a > ) -> PResult < ' a , T > ,
995- ) -> PResult < ' a , ( ThinVec < T > , bool /* trailing */ , Recovered ) > {
1001+ ) -> PResult < ' a , ( ThinVec < T > , Trailing , Recovered ) > {
9961002 self . parse_seq_to_before_tokens ( & [ ket] , sep, TokenExpectType :: Expect , f)
9971003 }
9981004
@@ -1004,7 +1010,7 @@ impl<'a> Parser<'a> {
10041010 ket : & TokenKind ,
10051011 sep : SeqSep ,
10061012 f : impl FnMut ( & mut Parser < ' a > ) -> PResult < ' a , T > ,
1007- ) -> PResult < ' a , ( ThinVec < T > , bool /* trailing */ ) > {
1013+ ) -> PResult < ' a , ( ThinVec < T > , Trailing ) > {
10081014 let ( val, trailing, recovered) = self . parse_seq_to_before_end ( ket, sep, f) ?;
10091015 if matches ! ( recovered, Recovered :: No ) {
10101016 self . eat ( ket) ;
@@ -1021,7 +1027,7 @@ impl<'a> Parser<'a> {
10211027 ket : & TokenKind ,
10221028 sep : SeqSep ,
10231029 f : impl FnMut ( & mut Parser < ' a > ) -> PResult < ' a , T > ,
1024- ) -> PResult < ' a , ( ThinVec < T > , bool /* trailing */ ) > {
1030+ ) -> PResult < ' a , ( ThinVec < T > , Trailing ) > {
10251031 self . expect ( bra) ?;
10261032 self . parse_seq_to_end ( ket, sep, f)
10271033 }
@@ -1033,7 +1039,7 @@ impl<'a> Parser<'a> {
10331039 & mut self ,
10341040 delim : Delimiter ,
10351041 f : impl FnMut ( & mut Parser < ' a > ) -> PResult < ' a , T > ,
1036- ) -> PResult < ' a , ( ThinVec < T > , bool /* trailing */ ) > {
1042+ ) -> PResult < ' a , ( ThinVec < T > , Trailing ) > {
10371043 self . parse_unspanned_seq (
10381044 & token:: OpenDelim ( delim) ,
10391045 & token:: CloseDelim ( delim) ,
@@ -1048,7 +1054,7 @@ impl<'a> Parser<'a> {
10481054 fn parse_paren_comma_seq < T > (
10491055 & mut self ,
10501056 f : impl FnMut ( & mut Parser < ' a > ) -> PResult < ' a , T > ,
1051- ) -> PResult < ' a , ( ThinVec < T > , bool /* trailing */ ) > {
1057+ ) -> PResult < ' a , ( ThinVec < T > , Trailing ) > {
10521058 self . parse_delim_comma_seq ( Delimiter :: Parenthesis , f)
10531059 }
10541060
0 commit comments