chore: clippy run

This commit is contained in:
Kevin K 2016-03-22 21:15:11 -04:00
parent 3d4192b655
commit 144e7e29d6
6 changed files with 22 additions and 18 deletions

View file

@ -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,
}
}

View file

@ -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(),
}

View file

@ -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 }

View file

@ -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> {

View file

@ -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));
}

View file

@ -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))]