Skip to content

Commit

Permalink
fix(derive): Reduce amount of deprecation noise
Browse files Browse the repository at this point in the history
The main thing that might slip through is `bool`.  We'll see if we an
re-introduce that.
  • Loading branch information
epage committed Jun 14, 2022
1 parent 63a17a4 commit 89beb28
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions clap_derive/src/derives/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Self, clap::Error> {
#[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)
}
Expand All @@ -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(())
}
Expand Down
4 changes: 4 additions & 0 deletions clap_derive/src/derives/subcommand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -542,6 +542,8 @@ fn gen_from_arg_matches(

quote! {
fn from_arg_matches_mut(__clap_arg_matches: &mut clap::ArgMatches) -> ::std::result::Result<Self, clap::Error> {
#[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() {
Expand Down Expand Up @@ -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 ),*
Expand Down

0 comments on commit 89beb28

Please sign in to comment.