@@ -30,11 +30,7 @@ impl<S: Stage> SingleAttributeParser<S> for RustcMustImplementOneOfParser {
3030 const ALLOWED_TARGETS : AllowedTargets = AllowedTargets :: AllowList ( & [ Allow ( Target :: Trait ) ] ) ;
3131 const TEMPLATE : AttributeTemplate = template ! ( List : & [ "function1, function2, ..." ] ) ;
3232 fn convert ( cx : & mut AcceptContext < ' _ , ' _ , S > , args : & ArgParser ) -> Option < AttributeKind > {
33- let Some ( list) = args. list ( ) else {
34- let span = cx. attr_span ;
35- cx. adcx ( ) . expected_list ( span, args) ;
36- return None ;
37- } ;
33+ let list = cx. list ( args, cx. attr_span ) ?;
3834
3935 let mut fn_names = ThinVec :: new ( ) ;
4036
@@ -210,11 +206,7 @@ fn parse_cgu_fields<S: Stage>(
210206 args : & ArgParser ,
211207 accepts_kind : bool ,
212208) -> Option < ( Symbol , Symbol , Option < CguKind > ) > {
213- let Some ( args) = args. list ( ) else {
214- let attr_span = cx. attr_span ;
215- cx. adcx ( ) . expected_list ( attr_span, args) ;
216- return None ;
217- } ;
209+ let args = cx. list ( args, cx. attr_span ) ?;
218210
219211 let mut cfg = None :: < ( Symbol , Span ) > ;
220212 let mut module = None :: < ( Symbol , Span ) > ;
@@ -418,11 +410,7 @@ impl<S: Stage> SingleAttributeParser<S> for RustcNeverTypeOptionsParser {
418410 ] ) ;
419411
420412 fn convert ( cx : & mut AcceptContext < ' _ , ' _ , S > , args : & ArgParser ) -> Option < AttributeKind > {
421- let Some ( list) = args. list ( ) else {
422- let attr_span = cx. attr_span ;
423- cx. adcx ( ) . expected_list ( attr_span, args) ;
424- return None ;
425- } ;
413+ let list = cx. list ( args, cx. attr_span ) ?;
426414
427415 let mut fallback = None :: < Ident > ;
428416 let mut diverging_block_default = None :: < Ident > ;
@@ -825,11 +813,8 @@ impl<S: Stage> CombineAttributeParser<S> for RustcCleanParser {
825813 if !cx. cx . sess . opts . unstable_opts . query_dep_graph {
826814 cx. emit_err ( AttributeRequiresOpt { span : cx. attr_span , opt : "-Z query-dep-graph" } ) ;
827815 }
828- let Some ( list) = args. list ( ) else {
829- let attr_span = cx. attr_span ;
830- cx. adcx ( ) . expected_list ( attr_span, args) ;
831- return None ;
832- } ;
816+ let list = cx. list ( args, cx. attr_span ) ?;
817+
833818 let mut except = None ;
834819 let mut loaded_from_disk = None ;
835820 let mut cfg = None ;
@@ -926,11 +911,7 @@ impl<S: Stage> SingleAttributeParser<S> for RustcIfThisChangedParser {
926911 match args {
927912 ArgParser :: NoArgs => Some ( AttributeKind :: RustcIfThisChanged ( cx. attr_span , None ) ) ,
928913 ArgParser :: List ( list) => {
929- let Some ( item) = list. single ( ) else {
930- let attr_span = cx. attr_span ;
931- cx. adcx ( ) . expected_single_argument ( attr_span, list. len ( ) ) ;
932- return None ;
933- } ;
914+ let item = cx. single ( list) ?;
934915 let Some ( ident) = item. meta_item ( ) . and_then ( |item| item. ident ( ) ) else {
935916 cx. adcx ( ) . expected_identifier ( item. span ( ) ) ;
936917 return None ;
0 commit comments