@@ -290,7 +290,7 @@ impl<'a> Parser<'a> {
290290 /// The delimiters or `=` are still put into the resulting token stream.
291291 pub fn parse_attr_item ( & mut self , force_collect : ForceCollect ) -> PResult < ' a , ast:: AttrItem > {
292292 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 ) ,
294294 |this| this. parse_attr_item ( force_collect) ,
295295 ) {
296296 return Ok ( item) ;
@@ -421,17 +421,13 @@ impl<'a> Parser<'a> {
421421 & mut self ,
422422 unsafe_allowed : AllowLeadingUnsafe ,
423423 ) -> 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 ( ) ) ;
435431 }
436432
437433 let lo = self . token . span ;
0 commit comments