diff --git a/src/app/meta.rs b/src/app/meta.rs index 3ca96e18..04626e0b 100644 --- a/src/app/meta.rs +++ b/src/app/meta.rs @@ -44,14 +44,14 @@ impl<'b> Clone for AppMeta<'b> { fn clone(&self) -> Self { AppMeta { name: self.name.clone(), - author: self.author.clone(), - about: self.about.clone(), - more_help: self.more_help.clone(), - version: self.version.clone(), - usage_str: self.usage_str.clone(), + author: self.author, + about: self.about, + more_help: self.more_help, + version: self.version, + usage_str: self.usage_str, usage: self.usage.clone(), bin_name: self.bin_name.clone(), - help_str: self.help_str.clone(), + help_str: self.help_str, disp_ord: self.disp_ord, } } diff --git a/src/app/parser.rs b/src/app/parser.rs index f25d0161..cc1adcd6 100644 --- a/src/app/parser.rs +++ b/src/app/parser.rs @@ -1577,8 +1577,8 @@ impl<'a, 'b> Clone for Parser<'a, 'b> where 'a: 'b { groups: self.groups.clone(), global_args: self.global_args.clone(), overrides: self.overrides.clone(), - help_short: self.help_short.clone(), - version_short: self.version_short.clone(), + help_short: self.help_short, + version_short: self.version_short, settings: self.settings.clone(), meta: self.meta.clone(), } diff --git a/src/args/arg_builder/option.rs b/src/args/arg_builder/option.rs index 5cdaa6d1..0e2da78d 100644 --- a/src/args/arg_builder/option.rs +++ b/src/args/arg_builder/option.rs @@ -175,6 +175,7 @@ impl<'n, 'e> AnyArg<'n, 'e> for OptBuilder<'n, 'e> { fn overrides(&self) -> Option<&[&'e str]> { self.overrides.as_ref().map(|o| &o[..]) } fn requires(&self) -> Option<&[&'e str]> { self.requires.as_ref().map(|o| &o[..]) } fn blacklist(&self) -> Option<&[&'e str]> { self.blacklist.as_ref().map(|o| &o[..]) } + #[cfg_attr(feature = "lints", allow(map_clone))] fn val_names(&self) -> Option<&VecMap<&'e str>> { self.val_names.as_ref().map(|o| o) } fn is_set(&self, s: ArgSettings) -> bool { self.settings.is_set(s) } fn has_switch(&self) -> bool { true } diff --git a/src/args/arg_matcher.rs b/src/args/arg_matcher.rs index 1fba132b..9a3a016c 100644 --- a/src/args/arg_matcher.rs +++ b/src/args/arg_matcher.rs @@ -12,9 +12,15 @@ use args::AnyArg; #[allow(missing_debug_implementations)] pub struct ArgMatcher<'a>(pub ArgMatches<'a>); +impl<'a> Default for ArgMatcher<'a> { + fn default() -> Self { + ArgMatcher(ArgMatches::default()) + } +} + impl<'a> ArgMatcher<'a> { pub fn new() -> Self { - ArgMatcher(ArgMatches::default()) + ArgMatcher::default() } pub fn get_mut(&mut self, arg: &str) -> Option<&mut MatchedArg> { diff --git a/src/args/help_writer.rs b/src/args/help_writer.rs index 183ef719..94247b99 100644 --- a/src/args/help_writer.rs +++ b/src/args/help_writer.rs @@ -118,10 +118,8 @@ impl<'a, 'n, 'e, A> HelpWriter<'a, A> where A: AnyArg<'n, 'e> + Display { } write_spaces!(spcs, w); } - } else { - if !(self.nlh || self.a.is_set(ArgSettings::NextLineHelp)) { - write_spaces!(self.l + 4 - (self.a.to_string().len()), w); - } + } else if !(self.nlh || self.a.is_set(ArgSettings::NextLineHelp)) { + write_spaces!(self.l + 4 - (self.a.to_string().len()), w); } Ok(()) } @@ -219,12 +217,10 @@ impl<'a, 'n, 'e, A> HelpWriter<'a, A> where A: AnyArg<'n, 'e> + Display { try!(write!(w, "\n")); if self.nlh || self.a.is_set(ArgSettings::NextLineHelp) { try!(write!(w, "{}{}", TAB, TAB)); + } else if self.a.has_switch() { + write_spaces!(self.l + 12, w); } else { - if self.a.has_switch() { - write_spaces!(self.l + 12, w); - } else { - write_spaces!(self.l + 8, w); - } + write_spaces!(self.l + 8, w); } try!(write!(w, "{}", part)); } diff --git a/src/lib.rs b/src/lib.rs index dabec14f..8901e9d9 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -391,6 +391,7 @@ trivial_casts, trivial_numeric_casts, unused_import_braces, + unused_allocation, unused_qualifications)] // clippy false positives, or ones we're ok with... #![cfg_attr(feature = "lints", allow(cyclomatic_complexity))]