@@ -310,7 +310,7 @@ impl<'a> Parser<'a> {
310310 /// The delimiters or `=` are still put into the resulting token stream.
311311 pub fn parse_attr_item ( & mut self , force_collect : ForceCollect ) -> PResult < ' a , ast:: AttrItem > {
312312 if let Some ( item) = self . eat_metavar_seq_with_matcher (
313- |mv_kind| matches ! ( mv_kind, MetaVarKind :: Meta { .. } ) ,
313+ |mv_kind| matches ! ( mv_kind, MetaVarKind :: Meta ) ,
314314 |this| this. parse_attr_item ( force_collect) ,
315315 ) {
316316 return Ok ( item) ;
@@ -420,17 +420,13 @@ impl<'a> Parser<'a> {
420420 & mut self ,
421421 unsafe_allowed : AllowLeadingUnsafe ,
422422 ) -> PResult < ' a , ast:: MetaItem > {
423- if let Some ( MetaVarKind :: Meta { has_meta_form } ) = self . token . is_metavar_seq ( ) {
424- return if has_meta_form {
425- let attr_item = self
426- . eat_metavar_seq ( MetaVarKind :: Meta { has_meta_form : true } , |this| {
427- this. parse_attr_item ( ForceCollect :: No )
428- } )
429- . unwrap ( ) ;
430- Ok ( attr_item. meta ( attr_item. path . span ) . unwrap ( ) )
431- } else {
432- self . unexpected_any ( )
433- } ;
423+ if let Some ( mv_kind @ ( MetaVarKind :: Meta | MetaVarKind :: Expr { .. } ) ) =
424+ self . token . is_metavar_seq ( )
425+ {
426+ return self
427+ . eat_metavar_seq ( mv_kind, |this| this. parse_attr_item ( ForceCollect :: No ) )
428+ . map ( |attr_item| attr_item. meta ( attr_item. path . span ) . unwrap ( ) )
429+ . ok_or_else ( || self . unexpected_any :: < core:: convert:: Infallible > ( ) . unwrap_err ( ) ) ;
434430 }
435431
436432 let lo = self . token . span ;
0 commit comments