fix: subcommand with field name subcmd compilation

This commit is contained in:
Omar El Halabi 2021-03-10 19:49:41 +02:00
parent 975ceed904
commit 777e0f43cb

View file

@ -315,7 +315,7 @@ pub fn gen_updater(
}; };
let updater = quote_spanned! { ty.span()=> let updater = quote_spanned! { ty.span()=>
<#subcmd_type as clap::Subcommand>::update_from_subcommand(#field_name, subcmd); <#subcmd_type as clap::Subcommand>::update_from_subcommand(#field_name, #arg_matches.subcommand());
}; };
let updater = match **ty { let updater = match **ty {
@ -324,7 +324,7 @@ pub fn gen_updater(
#updater #updater
} else { } else {
*#field_name = <#subcmd_type as clap::Subcommand>::from_subcommand( *#field_name = <#subcmd_type as clap::Subcommand>::from_subcommand(
subcmd #arg_matches.subcommand()
) )
} }
}, },
@ -335,7 +335,6 @@ pub fn gen_updater(
quote_spanned! { kind.span()=> quote_spanned! { kind.span()=>
{ {
let subcmd = #arg_matches.subcommand();
#access #access
#updater #updater
} }