Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rustup: fix nightly #433

Merged
merged 4 commits into from
Feb 24, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/app/meta.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#[doc(hidden)]
#[allow(missing_debug_implementations)]
pub struct AppMeta<'b> {
pub name: String,
pub bin_name: Option<String>,
Expand Down
23 changes: 11 additions & 12 deletions src/app/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ use osstringext::OsStrExt2;
use app::meta::AppMeta;
use args::MatchedArg;

#[allow(missing_debug_implementations)]
#[doc(hidden)]
pub struct Parser<'a, 'b> where 'a: 'b {
required: Vec<&'b str>,
Expand Down Expand Up @@ -295,7 +296,7 @@ impl<'a, 'b> Parser<'a, 'b> where 'a: 'b {
continue;
}
if let Some(p) = self.positionals.values().filter(|x| &x.name == &p).next() {
pmap.insert(p.index, format!("{}", p));
pmap.insert(p.index, p.to_string());
}
}
for (_, s) in pmap {
Expand All @@ -307,9 +308,7 @@ impl<'a, 'b> Parser<'a, 'b> where 'a: 'b {
if $m.is_some() && $m.as_ref().unwrap().contains(f) {
continue;
}
$r.push_back(format!("{}", $i.filter(|flg| &flg.name == &f)
.next()
.unwrap()));
$r.push_back($i.filter(|flg| &flg.name == &f).next().unwrap().to_string());
}
}
}
Expand Down Expand Up @@ -427,7 +426,7 @@ impl<'a, 'b> Parser<'a, 'b> where 'a: 'b {
debug!("Starts new arg...");
let starts_new_arg = if arg_os.starts_with(b"-") {
sdebugln!("Yes");
!(arg_os.len() == 1)
!(arg_os.len_() == 1)
} else {
sdebugln!("No");
false
Expand All @@ -448,7 +447,7 @@ impl<'a, 'b> Parser<'a, 'b> where 'a: 'b {
}
}
if arg_os.starts_with(b"--") {
if arg_os.len() == 2 {
if arg_os.len_() == 2 {
// The user has passed '--' which means only positional args follow no matter
// what they start with
pos_only = true;
Expand All @@ -457,7 +456,7 @@ impl<'a, 'b> Parser<'a, 'b> where 'a: 'b {

needs_val_of = try!(self.parse_long_arg(matcher, &arg_os));
continue;
} else if arg_os.starts_with(b"-") && arg_os.len() != 1 {
} else if arg_os.starts_with(b"-") && arg_os.len_() != 1 {
needs_val_of = try!(self.parse_short_arg(matcher, &arg_os));
if !(needs_val_of.is_none() && self.is_set(AppSettings::AllowLeadingHyphen)) {
continue;
Expand Down Expand Up @@ -628,21 +627,21 @@ impl<'a, 'b> Parser<'a, 'b> where 'a: 'b {
if let Some(f) = self.flags.iter().filter(|f| &f.name == &k).next() {
if let Some(ref bl) = f.blacklist {
if bl.contains(&name) {
return Some(format!("{}", f));
return Some(f.to_string());
}
}
}
if let Some(o) = self.opts.iter().filter(|o| &o.name == &k).next() {
if let Some(ref bl) = o.blacklist {
if bl.contains(&name) {
return Some(format!("{}", o));
return Some(o.to_string());
}
}
}
if let Some(pos) = self.positionals.values().filter(|p| &p.name == &k).next() {
if let Some(ref bl) = pos.blacklist {
if bl.contains(&name) {
return Some(format!("{}", pos));
return Some(pos.to_string());
}
}
}
Expand Down Expand Up @@ -972,7 +971,7 @@ impl<'a, 'b> Parser<'a, 'b> where 'a: 'b {
debug!("Checking for val...");
if let Some(fv) = val {
let v = fv.trim_left_matches(b'=');
if !opt.is_set(ArgSettings::EmptyValues) && v.len() == 0 {
if !opt.is_set(ArgSettings::EmptyValues) && v.len_() == 0 {
sdebugln!("Found Empty - Error");
return Err(Error::empty_value(opt, &*self.create_current_usage(matcher)));
}
Expand Down Expand Up @@ -1043,7 +1042,7 @@ impl<'a, 'b> Parser<'a, 'b> where 'a: 'b {
}
}
if !arg.is_set(ArgSettings::EmptyValues) &&
val.is_empty() &&
val.is_empty_() &&
matcher.contains(&*arg.name()) {
return Err(Error::empty_value(arg, &*self.create_current_usage(matcher)));
}
Expand Down
2 changes: 1 addition & 1 deletion src/args/arg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1842,7 +1842,7 @@ impl<'a, 'b, 'z> From<&'z Arg<'a, 'b>>
group: a.group,
validator: a.validator.clone(),
overrides: a.overrides.clone(),
settings: a.settings.clone(),
settings: a.settings,
val_delim: a.val_delim,
default_val: a.default_val,
}
Expand Down
2 changes: 1 addition & 1 deletion src/args/arg_builder/flag.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ impl<'a, 'b, 'z> From<&'z Arg<'a, 'b>> for FlagBuilder<'a, 'b> {
blacklist: a.blacklist.clone(),
overrides: a.overrides.clone(),
requires: a.requires.clone(),
settings: a.settings.clone(),
settings: a.settings,
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/args/arg_builder/option.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ impl<'n, 'e> OptBuilder<'n, 'e> {
overrides: a.overrides.clone(),
requires: a.requires.clone(),
possible_vals: a.possible_vals.clone(),
settings: a.settings.clone(),
settings: a.settings,
default_val: a.default_val,
..Default::default()
};
Expand Down
2 changes: 1 addition & 1 deletion src/args/arg_builder/positional.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ impl<'n, 'e> PosBuilder<'n, 'e> {
possible_vals: a.possible_vals.clone(),
help: a.help,
val_delim: a.val_delim,
settings: a.settings.clone(),
settings: a.settings,
default_val: a.default_val,
..Default::default()
};
Expand Down
1 change: 1 addition & 0 deletions src/args/arg_matcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use args::settings::ArgSettings;
use args::AnyArg;

#[doc(hidden)]
#[allow(missing_debug_implementations)]
pub struct ArgMatcher<'a>(pub ArgMatches<'a>);

impl<'a> ArgMatcher<'a> {
Expand Down
2 changes: 2 additions & 0 deletions src/args/arg_matches.rs
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,7 @@ impl<'a> ArgMatches<'a> {
// license: MIT - Copyright (c) 2015 The Rust Project Developers

#[derive(Clone)]
#[allow(missing_debug_implementations)]
pub struct Values<'a> {
iter: Map<vec_map::Values<'a, OsString>, fn(&'a OsString) -> &'a str>
}
Expand Down Expand Up @@ -559,6 +560,7 @@ impl<'a, V> DoubleEndedIterator for Iter<'a, V> {
}

#[derive(Clone)]
#[allow(missing_debug_implementations)]
pub struct OsValues<'a> {
iter: Map<vec_map::Values<'a, OsString>, fn(&'a OsString) -> &'a OsStr>
}
Expand Down
2 changes: 1 addition & 1 deletion src/args/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ bitflags! {
}

#[doc(hidden)]
#[derive(Debug, Clone)]
#[derive(Debug, Clone, Copy)]
pub struct ArgFlags(Flags);

impl ArgFlags {
Expand Down
10 changes: 5 additions & 5 deletions src/osstringext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ pub trait OsStrExt2 {
fn split_at_byte(&self, b: u8) -> (&OsStr, &OsStr);
fn split_at(&self, i: usize) -> (&OsStr, &OsStr);
fn trim_left_matches(&self, b: u8) -> &OsStr;
fn len(&self) -> usize;
fn len_(&self) -> usize;
fn contains_byte(&self, b: u8) -> bool;
fn is_empty(&self) -> bool;
fn is_empty_(&self) -> bool;
fn split(&self, b: u8) -> OsSplit;
}

Expand All @@ -39,7 +39,7 @@ impl OsStrExt2 for OsStr {
self.as_bytes().starts_with(s)
}

fn is_empty(&self) -> bool {
fn is_empty_(&self) -> bool {
self.as_bytes().is_empty()
}

Expand All @@ -54,7 +54,7 @@ impl OsStrExt2 for OsStr {
for (i, b) in self.as_bytes().iter().enumerate() {
if b == &byte { return (&OsStr::from_bytes(&self.as_bytes()[..i]), &OsStr::from_bytes(&self.as_bytes()[i+1..])); }
}
(&*self, &OsStr::from_bytes(&self.as_bytes()[self.len()..self.len()]))
(&*self, &OsStr::from_bytes(&self.as_bytes()[self.len_()..self.len_()]))
}

fn trim_left_matches(&self, byte: u8) -> &OsStr {
Expand All @@ -68,7 +68,7 @@ impl OsStrExt2 for OsStr {
(&OsStr::from_bytes(&self.as_bytes()[..i]), &OsStr::from_bytes(&self.as_bytes()[i..]))
}

fn len(&self) -> usize {
fn len_(&self) -> usize {
self.as_bytes().len()
}

Expand Down
2 changes: 1 addition & 1 deletion src/suggestions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ pub fn did_you_mean_suffix<'z, T, I>(arg: &str,
let mut suffix = "\n\tDid you mean ".to_owned();
match style {
DidYouMeanMessageStyle::LongFlag =>
suffix.push_str(&*format!("{}", Format::Good("--"))),
suffix.push_str(&Format::Good("--").to_string()),
DidYouMeanMessageStyle::EnumValue => suffix.push('\''),
}
suffix.push_str(&Format::Good(candidate).to_string()[..]);
Expand Down