Simplify getopts::find_opt.

This commit is contained in:
Erick Tryzelaar 2011-12-13 19:58:18 -08:00
parent 9db3525e42
commit 8e9be037d1

View File

@ -149,10 +149,7 @@ fn name_str(nm: name) -> str {
}
fn find_opt(opts: [opt], nm: name) -> option::t<uint> {
let i = 0u;
let l = vec::len::<opt>(opts);
while i < l { if opts[i].name == nm { ret some::<uint>(i); } i += 1u; }
ret none::<uint>;
vec::position_pred(opts, { |opt| opt.name == nm })
}
/*