@@ -124,7 +124,7 @@ impl<'a> Parser<'a> {
124
124
if this. eat ( & token:: Not ) { ast:: AttrStyle :: Inner } else { ast:: AttrStyle :: Outer } ;
125
125
126
126
this. expect ( & token:: OpenDelim ( Delimiter :: Bracket ) ) ?;
127
- let item = this. parse_attr_item ( false ) ?;
127
+ let item = this. parse_attr_item ( ForceCollect :: No ) ?;
128
128
this. expect ( & token:: CloseDelim ( Delimiter :: Bracket ) ) ?;
129
129
let attr_sp = lo. to ( this. prev_token . span ) ;
130
130
@@ -248,7 +248,7 @@ impl<'a> Parser<'a> {
248
248
/// PATH
249
249
/// PATH `=` UNSUFFIXED_LIT
250
250
/// The delimiters or `=` are still put into the resulting token stream.
251
- pub fn parse_attr_item ( & mut self , capture_tokens : bool ) -> PResult < ' a , ast:: AttrItem > {
251
+ pub fn parse_attr_item ( & mut self , force_collect : ForceCollect ) -> PResult < ' a , ast:: AttrItem > {
252
252
maybe_whole ! ( self , NtMeta , |attr| attr. into_inner( ) ) ;
253
253
254
254
let do_parse = |this : & mut Self | {
@@ -271,7 +271,10 @@ impl<'a> Parser<'a> {
271
271
Ok ( ast:: AttrItem { unsafety, path, args, tokens : None } )
272
272
} ;
273
273
// Attr items don't have attributes
274
- if capture_tokens { self . collect_tokens_no_attrs ( do_parse) } else { do_parse ( self ) }
274
+ match force_collect {
275
+ ForceCollect :: Yes => self . collect_tokens_no_attrs ( do_parse) ,
276
+ ForceCollect :: No => do_parse ( self ) ,
277
+ }
275
278
}
276
279
277
280
/// Parses attributes that appear after the opening of an item. These should
@@ -344,7 +347,7 @@ impl<'a> Parser<'a> {
344
347
let mut expanded_attrs = Vec :: with_capacity ( 1 ) ;
345
348
while self . token . kind != token:: Eof {
346
349
let lo = self . token . span ;
347
- let item = self . parse_attr_item ( true ) ?;
350
+ let item = self . parse_attr_item ( ForceCollect :: Yes ) ?;
348
351
expanded_attrs. push ( ( item, lo. to ( self . prev_token . span ) ) ) ;
349
352
if !self . eat ( & token:: Comma ) {
350
353
break ;
0 commit comments