From 89beb28e73ad681fe6bf28857c30bd4b1391e8cd Mon Sep 17 00:00:00 2001 From: Ed Page Date: Tue, 14 Jun 2022 08:53:11 -0500 Subject: [PATCH] fix(derive): Reduce amount of deprecation noise The main thing that might slip through is `bool`. We'll see if we an re-introduce that. --- clap_derive/src/derives/args.rs | 2 ++ clap_derive/src/derives/subcommand.rs | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/clap_derive/src/derives/args.rs b/clap_derive/src/derives/args.rs index 08ddcc91307..a2fcdf5a382 100644 --- a/clap_derive/src/derives/args.rs +++ b/clap_derive/src/derives/args.rs @@ -136,6 +136,7 @@ pub fn gen_from_arg_matches_for_struct( } fn from_arg_matches_mut(__clap_arg_matches: &mut clap::ArgMatches) -> ::std::result::Result { + #[allow(deprecated)] // Assuming any deprecation in here will be related to a deprecation in `Args` let v = #struct_name #constructor; ::std::result::Result::Ok(v) } @@ -145,6 +146,7 @@ pub fn gen_from_arg_matches_for_struct( } fn update_from_arg_matches_mut(&mut self, __clap_arg_matches: &mut clap::ArgMatches) -> ::std::result::Result<(), clap::Error> { + #[allow(deprecated)] // Assuming any deprecation in here will be related to a deprecation in `Args` #updater ::std::result::Result::Ok(()) } diff --git a/clap_derive/src/derives/subcommand.rs b/clap_derive/src/derives/subcommand.rs index 343c4e3e412..c10aeafdf91 100644 --- a/clap_derive/src/derives/subcommand.rs +++ b/clap_derive/src/derives/subcommand.rs @@ -542,6 +542,8 @@ fn gen_from_arg_matches( quote! { fn from_arg_matches_mut(__clap_arg_matches: &mut clap::ArgMatches) -> ::std::result::Result { + #[allow(deprecated)] // Assuming any deprecation in here will be related to a deprecation in `Subcommand` + #( #child_subcommands )else* if let Some((#subcommand_name_var, mut __clap_arg_sub_matches)) = __clap_arg_matches.remove_subcommand() { @@ -657,6 +659,8 @@ fn gen_update_from_arg_matches( &mut self, __clap_arg_matches: &mut clap::ArgMatches, ) -> ::std::result::Result<(), clap::Error> { + #[allow(deprecated)] // Assuming any deprecation in here will be related to a deprecation in `Subcommand` + if let Some(__clap_name) = __clap_arg_matches.subcommand_name() { match self { #( #subcommands ),*