diff options
Diffstat (limited to 'vendor/clap/examples/derive_ref/flatten_hand_args.rs')
-rw-r--r-- | vendor/clap/examples/derive_ref/flatten_hand_args.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/vendor/clap/examples/derive_ref/flatten_hand_args.rs b/vendor/clap/examples/derive_ref/flatten_hand_args.rs index 74d10edec..c10e0b29f 100644 --- a/vendor/clap/examples/derive_ref/flatten_hand_args.rs +++ b/vendor/clap/examples/derive_ref/flatten_hand_args.rs @@ -15,8 +15,8 @@ impl FromArgMatches for CliArgs { } fn from_arg_matches_mut(matches: &mut ArgMatches) -> Result<Self, Error> { Ok(Self { - foo: *matches.get_one::<bool>("foo").expect("defaulted by clap"), - bar: *matches.get_one::<bool>("bar").expect("defaulted by clap"), + foo: matches.get_flag("foo"), + bar: matches.get_flag("bar"), quuz: matches.remove_one::<String>("quuz"), }) } @@ -25,8 +25,8 @@ impl FromArgMatches for CliArgs { self.update_from_arg_matches_mut(&mut matches) } fn update_from_arg_matches_mut(&mut self, matches: &mut ArgMatches) -> Result<(), Error> { - self.foo |= *matches.get_one::<bool>("foo").expect("defaulted by clap"); - self.bar |= *matches.get_one::<bool>("bar").expect("defaulted by clap"); + self.foo |= matches.get_flag("foo"); + self.bar |= matches.get_flag("bar"); if let Some(quuz) = matches.remove_one::<String>("quuz") { self.quuz = Some(quuz); } |