@@ -124,7 +124,7 @@ impl<'a> Parser<'a> {
124124 if this. eat ( & token:: Not ) { ast:: AttrStyle :: Inner } else { ast:: AttrStyle :: Outer } ;
125125
126126 this. expect ( & token:: OpenDelim ( Delimiter :: Bracket ) ) ?;
127- let item = this. parse_attr_item ( false ) ?;
127+ let item = this. parse_attr_item ( ForceCollect :: No ) ?;
128128 this. expect ( & token:: CloseDelim ( Delimiter :: Bracket ) ) ?;
129129 let attr_sp = lo. to ( this. prev_token . span ) ;
130130
@@ -248,7 +248,7 @@ impl<'a> Parser<'a> {
248248 /// PATH
249249 /// PATH `=` UNSUFFIXED_LIT
250250 /// 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 > {
252252 maybe_whole ! ( self , NtMeta , |attr| attr. into_inner( ) ) ;
253253
254254 let do_parse = |this : & mut Self | {
@@ -271,7 +271,10 @@ impl<'a> Parser<'a> {
271271 Ok ( ast:: AttrItem { unsafety, path, args, tokens : None } )
272272 } ;
273273 // 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+ }
275278 }
276279
277280 /// Parses attributes that appear after the opening of an item. These should
@@ -344,7 +347,7 @@ impl<'a> Parser<'a> {
344347 let mut expanded_attrs = Vec :: with_capacity ( 1 ) ;
345348 while self . token . kind != token:: Eof {
346349 let lo = self . token . span ;
347- let item = self . parse_attr_item ( true ) ?;
350+ let item = self . parse_attr_item ( ForceCollect :: Yes ) ?;
348351 expanded_attrs. push ( ( item, lo. to ( self . prev_token . span ) ) ) ;
349352 if !self . eat ( & token:: Comma ) {
350353 break ;
0 commit comments