std: getopts now uses result::t (fixes #1289)

This commit is contained in:
Stefan Plantikow 2011-12-16 01:11:29 +01:00 committed by Brian Anderson
parent bd6b80c972
commit fa27724a4b
6 changed files with 72 additions and 63 deletions

View file

@ -11,6 +11,7 @@ import syntax::print::{pp, pprust};
import util::{ppaux, filesearch};
import back::link;
import core::{option, str, vec, int, result};
import result::{ok, err};
import std::{fs, io, getopts};
import option::{some, none};
import getopts::{optopt, optmulti, optflag, optflagopt, opt_present};
@ -621,8 +622,8 @@ fn main(args: [str]) {
let args = args, binary = vec::shift(args);
let match =
alt getopts::getopts(args, opts()) {
getopts::success(m) { m }
getopts::failure(f) {
ok(m) { m }
err(f) {
early_error(getopts::fail_str(f))
}
};
@ -670,7 +671,7 @@ mod test {
fn test_switch_implies_cfg_test() {
let match =
alt getopts::getopts(["--test"], opts()) {
getopts::success(m) { m }
ok(m) { m }
};
let sessopts = build_session_options(match);
let sess = build_session(sessopts);
@ -684,7 +685,7 @@ mod test {
fn test_switch_implies_cfg_test_unless_cfg_test() {
let match =
alt getopts::getopts(["--test", "--cfg=test"], opts()) {
getopts::success(m) { m }
ok(m) { m }
};
let sessopts = build_session_options(match);
let sess = build_session(sessopts);