@@ -371,6 +371,12 @@ impl From<Recovered> for bool {
371
371
}
372
372
}
373
373
374
+ #[ derive( Copy , Clone , Debug ) ]
375
+ pub enum Trailing {
376
+ No ,
377
+ Yes ,
378
+ }
379
+
374
380
#[ derive( Clone , Copy , PartialEq , Eq ) ]
375
381
pub enum TokenDescription {
376
382
ReservedIdentifier ,
@@ -797,10 +803,10 @@ impl<'a> Parser<'a> {
797
803
sep : SeqSep ,
798
804
expect : TokenExpectType ,
799
805
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 ) > {
801
807
let mut first = true ;
802
808
let mut recovered = Recovered :: No ;
803
- let mut trailing = false ;
809
+ let mut trailing = Trailing :: No ;
804
810
let mut v = ThinVec :: new ( ) ;
805
811
806
812
while !self . expect_any_with_type ( kets, expect) {
@@ -914,7 +920,7 @@ impl<'a> Parser<'a> {
914
920
}
915
921
}
916
922
if sep. trailing_sep_allowed && self . expect_any_with_type ( kets, expect) {
917
- trailing = true ;
923
+ trailing = Trailing :: Yes ;
918
924
break ;
919
925
}
920
926
@@ -992,7 +998,7 @@ impl<'a> Parser<'a> {
992
998
ket : & TokenKind ,
993
999
sep : SeqSep ,
994
1000
f : impl FnMut ( & mut Parser < ' a > ) -> PResult < ' a , T > ,
995
- ) -> PResult < ' a , ( ThinVec < T > , bool /* trailing */ , Recovered ) > {
1001
+ ) -> PResult < ' a , ( ThinVec < T > , Trailing , Recovered ) > {
996
1002
self . parse_seq_to_before_tokens ( & [ ket] , sep, TokenExpectType :: Expect , f)
997
1003
}
998
1004
@@ -1004,7 +1010,7 @@ impl<'a> Parser<'a> {
1004
1010
ket : & TokenKind ,
1005
1011
sep : SeqSep ,
1006
1012
f : impl FnMut ( & mut Parser < ' a > ) -> PResult < ' a , T > ,
1007
- ) -> PResult < ' a , ( ThinVec < T > , bool /* trailing */ ) > {
1013
+ ) -> PResult < ' a , ( ThinVec < T > , Trailing ) > {
1008
1014
let ( val, trailing, recovered) = self . parse_seq_to_before_end ( ket, sep, f) ?;
1009
1015
if matches ! ( recovered, Recovered :: No ) {
1010
1016
self . eat ( ket) ;
@@ -1021,7 +1027,7 @@ impl<'a> Parser<'a> {
1021
1027
ket : & TokenKind ,
1022
1028
sep : SeqSep ,
1023
1029
f : impl FnMut ( & mut Parser < ' a > ) -> PResult < ' a , T > ,
1024
- ) -> PResult < ' a , ( ThinVec < T > , bool /* trailing */ ) > {
1030
+ ) -> PResult < ' a , ( ThinVec < T > , Trailing ) > {
1025
1031
self . expect ( bra) ?;
1026
1032
self . parse_seq_to_end ( ket, sep, f)
1027
1033
}
@@ -1033,7 +1039,7 @@ impl<'a> Parser<'a> {
1033
1039
& mut self ,
1034
1040
delim : Delimiter ,
1035
1041
f : impl FnMut ( & mut Parser < ' a > ) -> PResult < ' a , T > ,
1036
- ) -> PResult < ' a , ( ThinVec < T > , bool /* trailing */ ) > {
1042
+ ) -> PResult < ' a , ( ThinVec < T > , Trailing ) > {
1037
1043
self . parse_unspanned_seq (
1038
1044
& token:: OpenDelim ( delim) ,
1039
1045
& token:: CloseDelim ( delim) ,
@@ -1048,7 +1054,7 @@ impl<'a> Parser<'a> {
1048
1054
fn parse_paren_comma_seq < T > (
1049
1055
& mut self ,
1050
1056
f : impl FnMut ( & mut Parser < ' a > ) -> PResult < ' a , T > ,
1051
- ) -> PResult < ' a , ( ThinVec < T > , bool /* trailing */ ) > {
1057
+ ) -> PResult < ' a , ( ThinVec < T > , Trailing ) > {
1052
1058
self . parse_delim_comma_seq ( Delimiter :: Parenthesis , f)
1053
1059
}
1054
1060
0 commit comments