De-mode vec::each() and many of the str iteration routines

Note that the method foo.each() is not de-moded, nor the other
vec routines.
This commit is contained in:
Niko Matsakis 2012-09-18 21:41:37 -07:00
parent 62b7f4d800
commit 9cf271fe96
81 changed files with 556 additions and 750 deletions

View file

@ -294,14 +294,14 @@ fn getopts(args: &[~str], opts: &[Opt]) -> Result unsafe {
let mut name_pos = 0u;
for vec::each(names) |nm| {
name_pos += 1u;
let optid = match find_opt(opts, nm) {
let optid = match find_opt(opts, *nm) {
Some(id) => id,
None => return Err(UnrecognizedOption(name_str(&nm)))
None => return Err(UnrecognizedOption(name_str(nm)))
};
match opts[optid].hasarg {
No => {
if !option::is_none::<~str>(i_arg) {
return Err(UnexpectedArgument(name_str(&nm)));
return Err(UnexpectedArgument(name_str(nm)));
}
vec::push(vals[optid], Given);
}
@ -318,7 +318,7 @@ fn getopts(args: &[~str], opts: &[Opt]) -> Result unsafe {
vec::push(vals[optid],
Val(option::get::<~str>(i_arg)));
} else if i + 1u == l {
return Err(ArgumentMissing(name_str(&nm)));
return Err(ArgumentMissing(name_str(nm)));
} else { i += 1u; vec::push(vals[optid], Val(args[i])); }
}
}
@ -367,7 +367,7 @@ fn opt_present(+mm: Matches, nm: &str) -> bool {
/// Returns true if any of several options were matched
fn opts_present(+mm: Matches, names: &[~str]) -> bool {
for vec::each(names) |nm| {
match find_opt(mm.opts, mkname(nm)) {
match find_opt(mm.opts, mkname(*nm)) {
Some(_) => return true,
None => ()
}
@ -394,7 +394,7 @@ fn opt_str(+mm: Matches, nm: &str) -> ~str {
*/
fn opts_str(+mm: Matches, names: &[~str]) -> ~str {
for vec::each(names) |nm| {
match opt_val(mm, nm) {
match opt_val(mm, *nm) {
Val(s) => return s,
_ => ()
}
@ -412,7 +412,7 @@ fn opts_str(+mm: Matches, names: &[~str]) -> ~str {
fn opt_strs(+mm: Matches, nm: &str) -> ~[~str] {
let mut acc: ~[~str] = ~[];
for vec::each(opt_vals(mm, nm)) |v| {
match v { Val(s) => vec::push(acc, s), _ => () }
match *v { Val(s) => vec::push(acc, s), _ => () }
}
return acc;
}