Skip to content

Commit 8e9be03

Browse files
committed
Simplify getopts::find_opt.
1 parent 9db3525 commit 8e9be03

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

src/libstd/getopts.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -149,10 +149,7 @@ fn name_str(nm: name) -> str {
149149
}
150150

151151
fn find_opt(opts: [opt], nm: name) -> option::t<uint> {
152-
let i = 0u;
153-
let l = vec::len::<opt>(opts);
154-
while i < l { if opts[i].name == nm { ret some::<uint>(i); } i += 1u; }
155-
ret none::<uint>;
152+
vec::position_pred(opts, { |opt| opt.name == nm })
156153
}
157154

158155
/*

0 commit comments

Comments
 (0)