to_either + fixes

This commit is contained in:
Erick Tryzelaar 2013-07-26 18:36:51 -07:00
parent aad53cb6e2
commit 2a68c719f4
10 changed files with 72 additions and 72 deletions

View file

@ -75,7 +75,7 @@ fn read_line() {
.push_rel(&Path("src/test/bench/shootout-k-nucleotide.data"));
for int::range(0, 3) |_i| {
let reader = result::unwrap(io::file_reader(&path));
let reader = io::file_reader(&path).unwrap();
while !reader.eof() {
reader.read_line();
}

View file

@ -124,8 +124,8 @@ fn main() {
};
let writer = if os::getenv("RUST_BENCH").is_some() {
result::unwrap(io::file_writer(&Path("./shootout-fasta.data"),
[io::Truncate, io::Create]))
io::file_writer(&Path("./shootout-fasta.data"),
[io::Truncate, io::Create]).unwrap()
} else {
io::stdout()
};

View file

@ -161,7 +161,7 @@ fn main() {
// get to this massive data set, but include_bin! chokes on it (#2598)
let path = Path(env!("CFG_SRC_DIR"))
.push_rel(&Path("src/test/bench/shootout-k-nucleotide.data"));
result::unwrap(io::file_reader(&path))
io::file_reader(&path).unwrap()
} else {
io::stdin()
};

View file

@ -13,5 +13,5 @@
use std::result;
fn main() {
error!(result::get(&result::Err::<int,~str>(~"kitty")));
error!(result::Err::<int,~str>(~"kitty").get());
}

View file

@ -16,7 +16,7 @@ use std::task;
fn adder(x: @int, y: @int) -> int { return *x + *y; }
fn failer() -> @int { fail!(); }
pub fn main() {
assert!(result::is_err(&task::try(|| {
assert!(task::try(|| {
adder(@2, failer()); ()
})));
}).is_err());
}

View file

@ -11,14 +11,13 @@
extern mod extra;
use std::result;
use extra::json;
use extra::serialize::Decodable;
trait JD : Decodable<json::Decoder> { }
fn exec<T: JD>() {
let doc = result::unwrap(json::from_str(""));
let doc = json::from_str("").unwrap();
let mut decoder = json::Decoder(doc);
let _v: T = Decodable::decode(&mut decoder);
fail!()