@@ -400,7 +400,7 @@ pub fn compile_declarative_macro(
400
400
let diag = & sess. parse_sess . span_diagnostic ;
401
401
let lhs_nm = Ident :: new ( sym:: lhs, def. span ) ;
402
402
let rhs_nm = Ident :: new ( sym:: rhs, def. span ) ;
403
- let tt_spec = Some ( NonterminalKind :: TT ) ;
403
+ let tt_spec = NonterminalKind :: TT ;
404
404
405
405
// Parse the macro_rules! invocation
406
406
let ( macro_rules, body) = match & def. kind {
@@ -577,7 +577,7 @@ fn check_lhs_no_empty_seq(sess: &ParseSess, tts: &[mbe::TokenTree]) -> bool {
577
577
TokenTree :: Sequence ( span, ref seq) => {
578
578
if seq. separator . is_none ( )
579
579
&& seq. tts . iter ( ) . all ( |seq_tt| match * seq_tt {
580
- TokenTree :: MetaVarDecl ( _, _, Some ( NonterminalKind :: Vis ) ) => true ,
580
+ TokenTree :: MetaVarDecl ( _, _, NonterminalKind :: Vis ) => true ,
581
581
TokenTree :: Sequence ( _, ref sub_seq) => {
582
582
sub_seq. kleene . op == mbe:: KleeneOp :: ZeroOrMore
583
583
|| sub_seq. kleene . op == mbe:: KleeneOp :: ZeroOrOne
@@ -960,7 +960,7 @@ fn check_matcher_core(
960
960
// Now `last` holds the complete set of NT tokens that could
961
961
// end the sequence before SUFFIX. Check that every one works with `suffix`.
962
962
for token in & last. tokens {
963
- if let TokenTree :: MetaVarDecl ( _, name, Some ( kind) ) = * token {
963
+ if let TokenTree :: MetaVarDecl ( _, name, kind) = * token {
964
964
for next_token in & suffix_first. tokens {
965
965
match is_in_follow ( next_token, kind) {
966
966
IsInFollow :: Yes => { }
@@ -1018,7 +1018,7 @@ fn check_matcher_core(
1018
1018
}
1019
1019
1020
1020
fn token_can_be_followed_by_any ( tok : & mbe:: TokenTree ) -> bool {
1021
- if let mbe:: TokenTree :: MetaVarDecl ( _, _, Some ( kind) ) = * tok {
1021
+ if let mbe:: TokenTree :: MetaVarDecl ( _, _, kind) = * tok {
1022
1022
frag_can_be_followed_by_any ( kind)
1023
1023
} else {
1024
1024
// (Non NT's can always be followed by anything in matchers.)
@@ -1123,7 +1123,7 @@ fn is_in_follow(tok: &mbe::TokenTree, kind: NonterminalKind) -> IsInFollow {
1123
1123
}
1124
1124
_ => IsInFollow :: No ( TOKENS ) ,
1125
1125
} ,
1126
- TokenTree :: MetaVarDecl ( _, _, Some ( NonterminalKind :: Block ) ) => IsInFollow :: Yes ,
1126
+ TokenTree :: MetaVarDecl ( _, _, NonterminalKind :: Block ) => IsInFollow :: Yes ,
1127
1127
_ => IsInFollow :: No ( TOKENS ) ,
1128
1128
}
1129
1129
}
@@ -1158,7 +1158,7 @@ fn is_in_follow(tok: &mbe::TokenTree, kind: NonterminalKind) -> IsInFollow {
1158
1158
TokenTree :: MetaVarDecl (
1159
1159
_,
1160
1160
_,
1161
- Some ( NonterminalKind :: Ident | NonterminalKind :: Ty | NonterminalKind :: Path ) ,
1161
+ NonterminalKind :: Ident | NonterminalKind :: Ty | NonterminalKind :: Path ,
1162
1162
) => IsInFollow :: Yes ,
1163
1163
_ => IsInFollow :: No ( TOKENS ) ,
1164
1164
}
@@ -1171,8 +1171,7 @@ fn quoted_tt_to_string(tt: &mbe::TokenTree) -> String {
1171
1171
match * tt {
1172
1172
mbe:: TokenTree :: Token ( ref token) => pprust:: token_to_string ( & token) ,
1173
1173
mbe:: TokenTree :: MetaVar ( _, name) => format ! ( "${}" , name) ,
1174
- mbe:: TokenTree :: MetaVarDecl ( _, name, Some ( kind) ) => format ! ( "${}:{}" , name, kind) ,
1175
- mbe:: TokenTree :: MetaVarDecl ( _, name, None ) => format ! ( "${}:" , name) ,
1174
+ mbe:: TokenTree :: MetaVarDecl ( _, name, kind) => format ! ( "${}:{}" , name, kind) ,
1176
1175
_ => panic ! (
1177
1176
"unexpected mbe::TokenTree::{{Sequence or Delimited}} \
1178
1177
in follow set checker"
0 commit comments