@@ -909,7 +909,7 @@ fn check_matcher_core(sess: &ParseSess,
909
909
continue ' each_last;
910
910
}
911
911
IsInFollow :: Yes => { }
912
- IsInFollow :: No ( ref possible) => {
912
+ IsInFollow :: No ( possible) => {
913
913
let may_be = if last. tokens . len ( ) == 1 &&
914
914
suffix_first. tokens . len ( ) == 1
915
915
{
@@ -933,7 +933,7 @@ fn check_matcher_core(sess: &ParseSess,
933
933
format ! ( "not allowed after `{}` fragments" , frag_spec) ,
934
934
) ;
935
935
let msg = "allowed there are: " ;
936
- match & possible[ .. ] {
936
+ match possible {
937
937
& [ ] => { }
938
938
& [ t] => {
939
939
err. note ( & format ! (
@@ -997,7 +997,7 @@ fn frag_can_be_followed_by_any(frag: &str) -> bool {
997
997
998
998
enum IsInFollow {
999
999
Yes ,
1000
- No ( Vec < & ' static str > ) ,
1000
+ No ( & ' static [ & ' static str ] ) ,
1001
1001
Invalid ( String , & ' static str ) ,
1002
1002
}
1003
1003
@@ -1029,28 +1029,28 @@ fn is_in_follow(tok: "ed::TokenTree, frag: &str) -> IsInFollow {
1029
1029
IsInFollow :: Yes
1030
1030
} ,
1031
1031
"stmt" | "expr" => {
1032
- let tokens = vec ! [ "`=>`" , "`,`" , "`;`" ] ;
1032
+ const TOKENS : & [ & str ] = & [ "`=>`" , "`,`" , "`;`" ] ;
1033
1033
match tok {
1034
1034
TokenTree :: Token ( token) => match token. kind {
1035
1035
FatArrow | Comma | Semi => IsInFollow :: Yes ,
1036
- _ => IsInFollow :: No ( tokens ) ,
1036
+ _ => IsInFollow :: No ( TOKENS ) ,
1037
1037
} ,
1038
- _ => IsInFollow :: No ( tokens ) ,
1038
+ _ => IsInFollow :: No ( TOKENS ) ,
1039
1039
}
1040
1040
} ,
1041
1041
"pat" => {
1042
- let tokens = vec ! [ "`=>`" , "`,`" , "`=`" , "`|`" , "`if`" , "`in`" ] ;
1042
+ const TOKENS : & [ & str ] = & [ "`=>`" , "`,`" , "`=`" , "`|`" , "`if`" , "`in`" ] ;
1043
1043
match tok {
1044
1044
TokenTree :: Token ( token) => match token. kind {
1045
1045
FatArrow | Comma | Eq | BinOp ( token:: Or ) => IsInFollow :: Yes ,
1046
1046
Ident ( name, false ) if name == kw:: If || name == kw:: In => IsInFollow :: Yes ,
1047
- _ => IsInFollow :: No ( tokens ) ,
1047
+ _ => IsInFollow :: No ( TOKENS ) ,
1048
1048
} ,
1049
- _ => IsInFollow :: No ( tokens ) ,
1049
+ _ => IsInFollow :: No ( TOKENS ) ,
1050
1050
}
1051
1051
} ,
1052
1052
"path" | "ty" => {
1053
- let tokens = vec ! [
1053
+ const TOKENS : & [ & str ] = & [
1054
1054
"`{`" , "`[`" , "`=>`" , "`,`" , "`>`" , "`=`" , "`:`" , "`;`" , "`|`" , "`as`" ,
1055
1055
"`where`" ,
1056
1056
] ;
@@ -1062,11 +1062,11 @@ fn is_in_follow(tok: "ed::TokenTree, frag: &str) -> IsInFollow {
1062
1062
BinOp ( token:: Or ) => IsInFollow :: Yes ,
1063
1063
Ident ( name, false ) if name == kw:: As ||
1064
1064
name == kw:: Where => IsInFollow :: Yes ,
1065
- _ => IsInFollow :: No ( tokens ) ,
1065
+ _ => IsInFollow :: No ( TOKENS ) ,
1066
1066
} ,
1067
1067
TokenTree :: MetaVarDecl ( _, _, frag) if frag. name == sym:: block =>
1068
1068
IsInFollow :: Yes ,
1069
- _ => IsInFollow :: No ( tokens ) ,
1069
+ _ => IsInFollow :: No ( TOKENS ) ,
1070
1070
}
1071
1071
} ,
1072
1072
"ident" | "lifetime" => {
@@ -1084,22 +1084,22 @@ fn is_in_follow(tok: "ed::TokenTree, frag: &str) -> IsInFollow {
1084
1084
} ,
1085
1085
"vis" => {
1086
1086
// Explicitly disallow `priv`, on the off chance it comes back.
1087
- let tokens = vec ! [ "`,`" , "an ident" , "a type" ] ;
1087
+ const TOKENS : & [ & str ] = & [ "`,`" , "an ident" , "a type" ] ;
1088
1088
match tok {
1089
1089
TokenTree :: Token ( token) => match token. kind {
1090
1090
Comma => IsInFollow :: Yes ,
1091
1091
Ident ( name, is_raw) if is_raw || name != kw:: Priv => IsInFollow :: Yes ,
1092
1092
_ => if token. can_begin_type ( ) {
1093
1093
IsInFollow :: Yes
1094
1094
} else {
1095
- IsInFollow :: No ( tokens )
1095
+ IsInFollow :: No ( TOKENS )
1096
1096
}
1097
1097
} ,
1098
1098
TokenTree :: MetaVarDecl ( _, _, frag) if frag. name == sym:: ident
1099
1099
|| frag. name == sym:: ty
1100
1100
|| frag. name == sym:: path =>
1101
1101
IsInFollow :: Yes ,
1102
- _ => IsInFollow :: No ( tokens ) ,
1102
+ _ => IsInFollow :: No ( TOKENS ) ,
1103
1103
}
1104
1104
} ,
1105
1105
"" => IsInFollow :: Yes , // kw::Invalid
0 commit comments