@@ -909,7 +909,7 @@ fn check_matcher_core(sess: &ParseSess,
909909 continue ' each_last;
910910 }
911911 IsInFollow :: Yes => { }
912- IsInFollow :: No ( ref possible) => {
912+ IsInFollow :: No ( possible) => {
913913 let may_be = if last. tokens . len ( ) == 1 &&
914914 suffix_first. tokens . len ( ) == 1
915915 {
@@ -933,7 +933,7 @@ fn check_matcher_core(sess: &ParseSess,
933933 format ! ( "not allowed after `{}` fragments" , frag_spec) ,
934934 ) ;
935935 let msg = "allowed there are: " ;
936- match & possible[ .. ] {
936+ match possible {
937937 & [ ] => { }
938938 & [ t] => {
939939 err. note ( & format ! (
@@ -997,7 +997,7 @@ fn frag_can_be_followed_by_any(frag: &str) -> bool {
997997
998998enum IsInFollow {
999999 Yes ,
1000- No ( Vec < & ' static str > ) ,
1000+ No ( & ' static [ & ' static str ] ) ,
10011001 Invalid ( String , & ' static str ) ,
10021002}
10031003
@@ -1029,28 +1029,28 @@ fn is_in_follow(tok: "ed::TokenTree, frag: &str) -> IsInFollow {
10291029 IsInFollow :: Yes
10301030 } ,
10311031 "stmt" | "expr" => {
1032- let tokens = vec ! [ "`=>`" , "`,`" , "`;`" ] ;
1032+ const TOKENS : & [ & str ] = & [ "`=>`" , "`,`" , "`;`" ] ;
10331033 match tok {
10341034 TokenTree :: Token ( token) => match token. kind {
10351035 FatArrow | Comma | Semi => IsInFollow :: Yes ,
1036- _ => IsInFollow :: No ( tokens ) ,
1036+ _ => IsInFollow :: No ( TOKENS ) ,
10371037 } ,
1038- _ => IsInFollow :: No ( tokens ) ,
1038+ _ => IsInFollow :: No ( TOKENS ) ,
10391039 }
10401040 } ,
10411041 "pat" => {
1042- let tokens = vec ! [ "`=>`" , "`,`" , "`=`" , "`|`" , "`if`" , "`in`" ] ;
1042+ const TOKENS : & [ & str ] = & [ "`=>`" , "`,`" , "`=`" , "`|`" , "`if`" , "`in`" ] ;
10431043 match tok {
10441044 TokenTree :: Token ( token) => match token. kind {
10451045 FatArrow | Comma | Eq | BinOp ( token:: Or ) => IsInFollow :: Yes ,
10461046 Ident ( name, false ) if name == kw:: If || name == kw:: In => IsInFollow :: Yes ,
1047- _ => IsInFollow :: No ( tokens ) ,
1047+ _ => IsInFollow :: No ( TOKENS ) ,
10481048 } ,
1049- _ => IsInFollow :: No ( tokens ) ,
1049+ _ => IsInFollow :: No ( TOKENS ) ,
10501050 }
10511051 } ,
10521052 "path" | "ty" => {
1053- let tokens = vec ! [
1053+ const TOKENS : & [ & str ] = & [
10541054 "`{`" , "`[`" , "`=>`" , "`,`" , "`>`" , "`=`" , "`:`" , "`;`" , "`|`" , "`as`" ,
10551055 "`where`" ,
10561056 ] ;
@@ -1062,11 +1062,11 @@ fn is_in_follow(tok: "ed::TokenTree, frag: &str) -> IsInFollow {
10621062 BinOp ( token:: Or ) => IsInFollow :: Yes ,
10631063 Ident ( name, false ) if name == kw:: As ||
10641064 name == kw:: Where => IsInFollow :: Yes ,
1065- _ => IsInFollow :: No ( tokens ) ,
1065+ _ => IsInFollow :: No ( TOKENS ) ,
10661066 } ,
10671067 TokenTree :: MetaVarDecl ( _, _, frag) if frag. name == sym:: block =>
10681068 IsInFollow :: Yes ,
1069- _ => IsInFollow :: No ( tokens ) ,
1069+ _ => IsInFollow :: No ( TOKENS ) ,
10701070 }
10711071 } ,
10721072 "ident" | "lifetime" => {
@@ -1084,22 +1084,22 @@ fn is_in_follow(tok: "ed::TokenTree, frag: &str) -> IsInFollow {
10841084 } ,
10851085 "vis" => {
10861086 // 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" ] ;
10881088 match tok {
10891089 TokenTree :: Token ( token) => match token. kind {
10901090 Comma => IsInFollow :: Yes ,
10911091 Ident ( name, is_raw) if is_raw || name != kw:: Priv => IsInFollow :: Yes ,
10921092 _ => if token. can_begin_type ( ) {
10931093 IsInFollow :: Yes
10941094 } else {
1095- IsInFollow :: No ( tokens )
1095+ IsInFollow :: No ( TOKENS )
10961096 }
10971097 } ,
10981098 TokenTree :: MetaVarDecl ( _, _, frag) if frag. name == sym:: ident
10991099 || frag. name == sym:: ty
11001100 || frag. name == sym:: path =>
11011101 IsInFollow :: Yes ,
1102- _ => IsInFollow :: No ( tokens ) ,
1102+ _ => IsInFollow :: No ( TOKENS ) ,
11031103 }
11041104 } ,
11051105 "" => IsInFollow :: Yes , // kw::Invalid
0 commit comments