mirror of
https://github.com/clap-rs/clap
synced 2024-12-13 14:22:34 +00:00
refactor(derive): Don't alias arg matches
Right now, the aliasing is safe (the compiler says so!) but we're going to be switching to a `&mut` and need to ensure we don't alias.
This commit is contained in:
parent
1446be8a89
commit
5806e16dd4
1 changed files with 3 additions and 3 deletions
|
@ -604,7 +604,7 @@ fn gen_update_from_arg_matches(
|
|||
quote!((ref mut __clap_arg)),
|
||||
quote!(clap::FromArgMatches::update_from_arg_matches(
|
||||
__clap_arg,
|
||||
__clap_sub_arg_matches
|
||||
__clap_arg_matches
|
||||
)?),
|
||||
)
|
||||
} else {
|
||||
|
@ -615,7 +615,7 @@ fn gen_update_from_arg_matches(
|
|||
|
||||
quote! {
|
||||
#name :: #variant_name #pattern if #sub_name == __clap_name => {
|
||||
let __clap_arg_matches = __clap_sub_arg_matches;
|
||||
let (_, __clap_arg_matches) = __clap_arg_matches.subcommand().unwrap();
|
||||
#updater
|
||||
}
|
||||
}
|
||||
|
@ -647,7 +647,7 @@ fn gen_update_from_arg_matches(
|
|||
&mut self,
|
||||
__clap_arg_matches: &clap::ArgMatches,
|
||||
) -> ::std::result::Result<(), clap::Error> {
|
||||
if let Some((__clap_name, __clap_sub_arg_matches)) = __clap_arg_matches.subcommand() {
|
||||
if let Some(__clap_name) = __clap_arg_matches.subcommand_name() {
|
||||
match self {
|
||||
#( #subcommands ),*
|
||||
s => {
|
||||
|
|
Loading…
Reference in a new issue