mirror of
https://github.com/clap-rs/clap
synced 2025-03-04 23:37:32 +00:00
commit
96869dfd57
8 changed files with 24 additions and 19 deletions
|
@ -2,6 +2,7 @@ sudo: false
|
|||
language: rust
|
||||
rust:
|
||||
- nightly
|
||||
- nightly-2016-03-22
|
||||
- beta
|
||||
- stable
|
||||
# Only while clippy is failing
|
||||
|
|
|
@ -18,7 +18,7 @@ libc = { version = "~0.2.8", optional = true }
|
|||
ansi_term = { version = "~0.7.2", optional = true }
|
||||
strsim = { version = "~0.4.0", optional = true }
|
||||
yaml-rust = { version = "~0.3", optional = true }
|
||||
clippy = { version = "~0.0.48", optional = true }
|
||||
clippy = { version = "=0.0.55", optional = true }
|
||||
|
||||
[features]
|
||||
default = ["suggestions", "color", "wrap_help"]
|
||||
|
|
|
@ -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,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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(),
|
||||
}
|
||||
|
|
|
@ -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 }
|
||||
|
|
|
@ -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> {
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
|
|
|
@ -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))]
|
||||
|
|
Loading…
Add table
Reference in a new issue