Skip to content

Commit

Permalink
refactor(derive): Make flatten's update prepped for Option
Browse files Browse the repository at this point in the history
  • Loading branch information
epage committed Oct 5, 2022
1 parent f121a8b commit 33db640
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions clap_derive/src/derives/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -522,9 +522,18 @@ pub fn gen_updater(fields: &[(&Field, Item)], use_self: bool) -> TokenStream {
}
}

Kind::Flatten(_) => quote_spanned! { kind.span()=> {
#access
clap::FromArgMatches::update_from_arg_matches_mut(#field_name, #arg_matches)?;
Kind::Flatten(_) => {
let updater = quote_spanned! { kind.span()=> {
#access
clap::FromArgMatches::update_from_arg_matches_mut(#field_name, #arg_matches)?;
}
};

quote_spanned! { kind.span()=>
{
#access
#updater
}
}
},

Expand Down

0 comments on commit 33db640

Please sign in to comment.