@@ -290,7 +290,7 @@ impl<'a> Parser<'a> {
290
290
/// The delimiters or `=` are still put into the resulting token stream.
291
291
pub fn parse_attr_item ( & mut self , force_collect : ForceCollect ) -> PResult < ' a , ast:: AttrItem > {
292
292
if let Some ( item) = self . eat_metavar_seq_with_matcher (
293
- |mv_kind| matches ! ( mv_kind, MetaVarKind :: Meta { .. } ) ,
293
+ |mv_kind| matches ! ( mv_kind, MetaVarKind :: Meta ) ,
294
294
|this| this. parse_attr_item ( force_collect) ,
295
295
) {
296
296
return Ok ( item) ;
@@ -421,17 +421,13 @@ impl<'a> Parser<'a> {
421
421
& mut self ,
422
422
unsafe_allowed : AllowLeadingUnsafe ,
423
423
) -> PResult < ' a , ast:: MetaItem > {
424
- if let Some ( MetaVarKind :: Meta { has_meta_form } ) = self . token . is_metavar_seq ( ) {
425
- return if has_meta_form {
426
- let attr_item = self
427
- . eat_metavar_seq ( MetaVarKind :: Meta { has_meta_form : true } , |this| {
428
- this. parse_attr_item ( ForceCollect :: No )
429
- } )
430
- . unwrap ( ) ;
431
- Ok ( attr_item. meta ( attr_item. path . span ) . unwrap ( ) )
432
- } else {
433
- self . unexpected_any ( )
434
- } ;
424
+ if let Some ( mv_kind @ ( MetaVarKind :: Meta | MetaVarKind :: Expr { .. } ) ) =
425
+ self . token . is_metavar_seq ( )
426
+ {
427
+ return self
428
+ . eat_metavar_seq ( mv_kind, |this| this. parse_attr_item ( ForceCollect :: No ) )
429
+ . map ( |attr_item| attr_item. meta ( attr_item. path . span ) . unwrap ( ) )
430
+ . ok_or_else ( || self . unexpected_any :: < core:: convert:: Infallible > ( ) . unwrap_err ( ) ) ;
435
431
}
436
432
437
433
let lo = self . token . span ;
0 commit comments