@@ -5019,9 +5019,6 @@ pub struct Variant {
50195019 pub inline_fields : Option < Vec < syn:: Field > > ,
50205020 /// `#[usage(run)]` on a variant: this command is synchronous even when the enum awaits.
50215021 pub run_sync : bool ,
5022- /// Whether the variant wrote redundant `#[usage(run_async)]`, retained so validation can
5023- /// point at the variant and explain that async enum dispatch already awaits by default.
5024- pub run_async : bool ,
50255022 /// `#[usage(no_ctx)]`: this command does not take the context the rest of the enum does.
50265023 pub no_ctx : bool ,
50275024 /// The struct the variant wraps, with any `Box` taken off.
@@ -5219,7 +5216,7 @@ impl Subcommands {
52195216 ) ) ;
52205217 }
52215218 for v in & variants {
5222- if v. external && ( v. run_sync || v. run_async || v . no_ctx ) {
5219+ if v. external && ( v. run_sync || v. no_ctx ) {
52235220 return Err ( syn:: Error :: new_spanned (
52245221 & v. ident ,
52255222 "an `external_subcommand` is dispatched by the enum's `external = …` \
@@ -5233,13 +5230,6 @@ impl Subcommands {
52335230 dispatch already calls `Run` for every variant",
52345231 ) ) ;
52355232 }
5236- if v. run_async {
5237- return Err ( syn:: Error :: new_spanned (
5238- & v. ident ,
5239- "`run_async` on a variant is redundant; async enum dispatch already \
5240- awaits every variant unless that variant says `#[usage(run)]`",
5241- ) ) ;
5242- }
52435233 if v. no_ctx && !has_ctx {
52445234 return Err ( syn:: Error :: new_spanned (
52455235 & v. ident ,
@@ -5252,9 +5242,7 @@ impl Subcommands {
52525242 }
52535243 } else if dispatch_external. is_some ( )
52545244 || dispatch_output. is_some ( )
5255- || variants
5256- . iter ( )
5257- . any ( |v| v. run_sync || v. run_async || v. no_ctx )
5245+ || variants. iter ( ) . any ( |v| v. run_sync || v. no_ctx )
52585246 {
52595247 return Err ( syn:: Error :: new_spanned (
52605248 & input. ident ,
@@ -5305,7 +5293,6 @@ impl Variant {
53055293 let mut after_long_help = None ;
53065294 let mut examples: Vec < ExampleDecl > = Vec :: new ( ) ;
53075295 let mut run_sync = false ;
5308- let mut run_async = false ;
53095296 let mut no_ctx = false ;
53105297
53115298 for attr in attrs ( & variant. attrs ) {
@@ -5346,7 +5333,16 @@ impl Variant {
53465333 "example" => examples. push ( example_decl ( & meta) ?) ,
53475334 "verbatim_doc_comment" => verbatim_doc_comment = flag_value ( & meta) ?,
53485335 "run" => run_sync = flag_value ( & meta) ?,
5349- "run_async" => run_async = flag_value ( & meta) ?,
5336+ "run_async" => {
5337+ if flag_value ( & meta) ? {
5338+ return Err ( syn:: Error :: new_spanned (
5339+ path,
5340+ "`run_async` on a variant is redundant; async enum dispatch \
5341+ already awaits every variant unless that variant says \
5342+ `#[usage(run)]`",
5343+ ) ) ;
5344+ }
5345+ }
53505346 "no_ctx" => no_ctx = flag_value ( & meta) ?,
53515347 other => {
53525348 return Err ( syn:: Error :: new_spanned (
@@ -5467,7 +5463,6 @@ impl Variant {
54675463 unit : false ,
54685464 inline_fields : None ,
54695465 run_sync,
5470- run_async,
54715466 no_ctx,
54725467 ty : held,
54735468 boxed : false ,
@@ -5540,7 +5535,6 @@ impl Variant {
55405535 unit,
55415536 inline_fields,
55425537 run_sync,
5543- run_async,
55445538 no_ctx,
55455539 ty,
55465540 boxed,
0 commit comments