Skip to content

Commit d05e2ad

Browse files
committed
Demode core::result
1 parent 62649f0 commit d05e2ad

23 files changed

+153
-145
lines changed

src/cargo/cargo.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,7 @@ fn parse_source(name: ~str, j: json::Json) -> source {
460460
fn try_parse_sources(filename: &Path, sources: map::HashMap<~str, source>) {
461461
if !os::path_exists(filename) { return; }
462462
let c = io::read_whole_file_str(filename);
463-
match json::from_str(result::get(c)) {
463+
match json::from_str(c.get()) {
464464
Ok(json::Dict(j)) => {
465465
for j.each |k, v| {
466466
sources.insert(k, parse_source(k, v));
@@ -579,7 +579,7 @@ fn load_source_info(c: &cargo, src: source) {
579579
let srcfile = dir.push("source.json");
580580
if !os::path_exists(&srcfile) { return; }
581581
let srcstr = io::read_whole_file_str(&srcfile);
582-
match json::from_str(result::get(srcstr)) {
582+
match json::from_str(srcstr.get()) {
583583
Ok(json::Dict(s)) => {
584584
let o = parse_source(src.name, json::Dict(s));
585585

@@ -601,7 +601,7 @@ fn load_source_packages(c: &cargo, src: source) {
601601
let pkgfile = dir.push("packages.json");
602602
if !os::path_exists(&pkgfile) { return; }
603603
let pkgstr = io::read_whole_file_str(&pkgfile);
604-
match json::from_str(result::get(pkgstr)) {
604+
match json::from_str(pkgstr.get()) {
605605
Ok(json::List(js)) => {
606606
for (*js).each |j| {
607607
match *j {
@@ -659,7 +659,7 @@ fn build_cargo_options(argv: ~[~str]) -> options {
659659
fn configure(opts: options) -> cargo {
660660
let home = match get_cargo_root() {
661661
Ok(home) => home,
662-
Err(_err) => result::get(get_cargo_sysroot())
662+
Err(_err) => get_cargo_sysroot().get()
663663
};
664664

665665
let get_cargo_dir = match opts.mode {
@@ -668,7 +668,7 @@ fn configure(opts: options) -> cargo {
668668
local_mode => get_cargo_root_nearest
669669
};
670670

671-
let p = result::get(get_cargo_dir());
671+
let p = get_cargo_dir().get();
672672

673673
let sources = map::HashMap();
674674
try_parse_sources(&home.push("sources.json"), sources);

src/compiletest/errors.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ type expected_error = { line: uint, kind: ~str, msg: ~str };
99
// Load any test directives embedded in the file
1010
fn load_errors(testfile: &Path) -> ~[expected_error] {
1111
let mut error_patterns = ~[];
12-
let rdr = result::get(io::file_reader(testfile));
12+
let rdr = io::file_reader(testfile).get();
1313
let mut line_num = 1u;
1414
while !rdr.eof() {
1515
let ln = rdr.read_line();

src/compiletest/header.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ fn is_test_ignored(config: config, testfile: &Path) -> bool {
7373
}
7474
7575
fn iter_header(testfile: &Path, it: fn(~str) -> bool) -> bool {
76-
let rdr = result::get(io::file_reader(testfile));
76+
let rdr = io::file_reader(testfile).get();
7777
while !rdr.eof() {
7878
let ln = rdr.read_line();
7979

src/compiletest/runtest.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ fn run_pretty_test(config: config, props: test_props, testfile: &Path) {
109109
let rounds =
110110
match props.pp_exact { option::Some(_) => 1, option::None => 2 };
111111

112-
let mut srcs = ~[result::get(io::read_whole_file_str(testfile))];
112+
let mut srcs = ~[io::read_whole_file_str(testfile).get()];
113113

114114
let mut round = 0;
115115
while round < rounds {
@@ -129,7 +129,7 @@ fn run_pretty_test(config: config, props: test_props, testfile: &Path) {
129129
match props.pp_exact {
130130
option::Some(file) => {
131131
let filepath = testfile.dir_path().push_rel(&file);
132-
result::get(io::read_whole_file_str(&filepath))
132+
io::read_whole_file_str(&filepath).get()
133133
}
134134
option::None => { srcs[vec::len(srcs) - 2u] }
135135
};
@@ -561,8 +561,8 @@ fn dump_output(config: config, testfile: &Path, out: ~str, err: ~str) {
561561
fn dump_output_file(config: config, testfile: &Path,
562562
out: ~str, extension: ~str) {
563563
let outfile = make_out_name(config, testfile, extension);
564-
let writer = result::get(
565-
io::file_writer(&outfile, ~[io::Create, io::Truncate]));
564+
let writer =
565+
io::file_writer(&outfile, ~[io::Create, io::Truncate]).get();
566566
writer.write_str(out);
567567
}
568568

src/fuzzer/fuzzer.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ impl test_mode : cmp::Eq {
1919

2020
fn write_file(filename: &Path, content: ~str) {
2121
result::get(
22-
io::file_writer(filename, ~[io::Create, io::Truncate]))
22+
&io::file_writer(filename, ~[io::Create, io::Truncate]))
2323
.write_str(content);
2424
}
2525

@@ -543,7 +543,7 @@ fn check_convergence(files: &[Path]) {
543543
error!("pp convergence tests: %u files", vec::len(files));
544544
for files.each |file| {
545545
if !file_might_not_converge(file) {
546-
let s = @result::get(io::read_whole_file_str(file));
546+
let s = @result::get(&io::read_whole_file_str(file));
547547
if !content_might_not_converge(*s) {
548548
error!("pp converge: %s", file.to_str());
549549
// Change from 7u to 2u once
@@ -563,7 +563,7 @@ fn check_variants(files: &[Path], cx: context) {
563563
loop;
564564
}
565565

566-
let s = @result::get(io::read_whole_file_str(file));
566+
let s = @result::get(&io::read_whole_file_str(file));
567567
if contains(*s, ~"#") {
568568
loop; // Macros are confusing
569569
}

src/libcore/comm.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,7 @@ fn test_recv_chan_wrong_task() {
459459
let po = Port();
460460
let ch = Chan(po);
461461
send(ch, ~"flower");
462-
assert result::is_err(task::try(||
462+
assert result::is_err(&task::try(||
463463
recv_chan(ch)
464464
))
465465
}

src/libcore/io.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -645,7 +645,7 @@ impl<T: Writer> T : WriterUtil {
645645

646646
#[allow(non_implicitly_copyable_typarams)]
647647
fn file_writer(path: &Path, flags: ~[FileFlag]) -> Result<Writer, ~str> {
648-
result::chain(mk_file_writer(path, flags), |w| result::Ok(w))
648+
mk_file_writer(path, flags).chain(|w| result::Ok(w))
649649
}
650650

651651

@@ -864,10 +864,10 @@ mod tests {
864864
{
865865
let out: io::Writer =
866866
result::get(
867-
io::file_writer(tmpfile, ~[io::Create, io::Truncate]));
867+
&io::file_writer(tmpfile, ~[io::Create, io::Truncate]));
868868
out.write_str(frood);
869869
}
870-
let inp: io::Reader = result::get(io::file_reader(tmpfile));
870+
let inp: io::Reader = result::get(&io::file_reader(tmpfile));
871871
let frood2: ~str = inp.read_c_str();
872872
log(debug, frood2);
873873
assert frood == frood2;

src/libcore/private.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ fn test_weaken_task_fail() {
283283
}
284284
}
285285
};
286-
assert result::is_err(res);
286+
assert result::is_err(&res);
287287
}
288288

289289
/****************************************************************************

0 commit comments

Comments
 (0)