@@ -24,12 +24,12 @@ pub struct Delimited {
24
24
25
25
impl Delimited {
26
26
/// Returns the opening delimiter (possibly `NoDelim`).
27
- pub fn open_token ( & self ) -> token :: TokenKind {
27
+ pub fn open_token ( & self ) -> TokenKind {
28
28
token:: OpenDelim ( self . delim )
29
29
}
30
30
31
31
/// Returns the closing delimiter (possibly `NoDelim`).
32
- pub fn close_token ( & self ) -> token :: TokenKind {
32
+ pub fn close_token ( & self ) -> TokenKind {
33
33
token:: CloseDelim ( self . delim )
34
34
}
35
35
@@ -59,7 +59,7 @@ pub struct SequenceRepetition {
59
59
/// The sequence of token trees
60
60
pub tts : Vec < TokenTree > ,
61
61
/// The optional separator
62
- pub separator : Option < token :: TokenKind > ,
62
+ pub separator : Option < TokenKind > ,
63
63
/// Whether the sequence can be repeated zero (*), or one or more times (+)
64
64
pub op : KleeneOp ,
65
65
/// The number of `Match`s that appear in the sequence (and subsequences)
@@ -210,20 +210,21 @@ pub fn parse(
210
210
match tree {
211
211
TokenTree :: MetaVar ( start_sp, ident) if expect_matchers => {
212
212
let span = match trees. next ( ) {
213
- Some ( tokenstream:: TokenTree :: Token ( Token { kind : token:: Colon , span } ) ) => match trees. next ( ) {
214
- Some ( tokenstream:: TokenTree :: Token ( token) ) => match token. ident ( ) {
215
- Some ( ( kind, _) ) => {
216
- let span = token. span . with_lo ( start_sp. lo ( ) ) ;
217
- result. push ( TokenTree :: MetaVarDecl ( span, ident, kind) ) ;
218
- continue ;
219
- }
220
- _ => token. span ,
213
+ Some ( tokenstream:: TokenTree :: Token ( Token { kind : token:: Colon , span } ) ) =>
214
+ match trees. next ( ) {
215
+ Some ( tokenstream:: TokenTree :: Token ( token) ) => match token. ident ( ) {
216
+ Some ( ( kind, _) ) => {
217
+ let span = token. span . with_lo ( start_sp. lo ( ) ) ;
218
+ result. push ( TokenTree :: MetaVarDecl ( span, ident, kind) ) ;
219
+ continue ;
220
+ }
221
+ _ => token. span ,
222
+ } ,
223
+ tree => tree
224
+ . as_ref ( )
225
+ . map ( tokenstream:: TokenTree :: span)
226
+ . unwrap_or ( span) ,
221
227
} ,
222
- tree => tree
223
- . as_ref ( )
224
- . map ( tokenstream:: TokenTree :: span)
225
- . unwrap_or ( span) ,
226
- } ,
227
228
tree => tree
228
229
. as_ref ( )
229
230
. map ( tokenstream:: TokenTree :: span)
@@ -370,7 +371,7 @@ where
370
371
371
372
/// Takes a token and returns `Some(KleeneOp)` if the token is `+` `*` or `?`. Otherwise, return
372
373
/// `None`.
373
- fn kleene_op ( token : & token :: TokenKind ) -> Option < KleeneOp > {
374
+ fn kleene_op ( token : & TokenKind ) -> Option < KleeneOp > {
374
375
match * token {
375
376
token:: BinOp ( token:: Star ) => Some ( KleeneOp :: ZeroOrMore ) ,
376
377
token:: BinOp ( token:: Plus ) => Some ( KleeneOp :: OneOrMore ) ,
@@ -423,7 +424,7 @@ fn parse_sep_and_kleene_op<I>(
423
424
attrs : & [ ast:: Attribute ] ,
424
425
edition : Edition ,
425
426
macro_node_id : NodeId ,
426
- ) -> ( Option < token :: TokenKind > , KleeneOp )
427
+ ) -> ( Option < TokenKind > , KleeneOp )
427
428
where
428
429
I : Iterator < Item = tokenstream:: TokenTree > ,
429
430
{
@@ -448,7 +449,7 @@ fn parse_sep_and_kleene_op_2015<I>(
448
449
_features : & Features ,
449
450
_attrs : & [ ast:: Attribute ] ,
450
451
macro_node_id : NodeId ,
451
- ) -> ( Option < token :: TokenKind > , KleeneOp )
452
+ ) -> ( Option < TokenKind > , KleeneOp )
452
453
where
453
454
I : Iterator < Item = tokenstream:: TokenTree > ,
454
455
{
@@ -566,7 +567,7 @@ fn parse_sep_and_kleene_op_2018<I>(
566
567
sess : & ParseSess ,
567
568
_features : & Features ,
568
569
_attrs : & [ ast:: Attribute ] ,
569
- ) -> ( Option < token :: TokenKind > , KleeneOp )
570
+ ) -> ( Option < TokenKind > , KleeneOp )
570
571
where
571
572
I : Iterator < Item = tokenstream:: TokenTree > ,
572
573
{
0 commit comments