From 75425f1fe804ca93cf534178fbe8513c3ea820f9 Mon Sep 17 00:00:00 2001 From: Haitao Li Date: Mon, 22 Dec 2014 11:39:02 +1100 Subject: [PATCH] Fix build with rust nightly Dec-20-2014 --- src/paste/paste.rs | 3 ++- src/split/split.rs | 5 +++-- src/tac/tac.rs | 3 ++- src/uniq/uniq.rs | 6 ++++-- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/paste/paste.rs b/src/paste/paste.rs index 38d210c43..04b77ee4c 100644 --- a/src/paste/paste.rs +++ b/src/paste/paste.rs @@ -62,7 +62,8 @@ fn paste(filenames: Vec, serial: bool, delimiters: &str) { if name.as_slice() == "-" { box io::stdio::stdin_raw() as Box } else { - box crash_if_err!(1, io::File::open(&Path::new(name))) as Box + let r = crash_if_err!(1, io::File::open(&Path::new(name))); + box r as Box } ) ).collect(); diff --git a/src/split/split.rs b/src/split/split.rs index e4b4fc6a8..f6d99fb86 100644 --- a/src/split/split.rs +++ b/src/split/split.rs @@ -221,10 +221,11 @@ fn split(settings: &Settings) -> int { if settings.input.as_slice() == "-" { box io::stdio::stdin_raw() as Box } else { - box match io::File::open(&Path::new(settings.input.clone())) { + let r = match io::File::open(&Path::new(settings.input.clone())) { Ok(a) => a, Err(_) => crash!(1, "cannot open '{}' for reading: No such file or directory", settings.input) - } as Box + }; + box r as Box } ); diff --git a/src/tac/tac.rs b/src/tac/tac.rs index 6eab7e6a1..cadbd43e4 100644 --- a/src/tac/tac.rs +++ b/src/tac/tac.rs @@ -75,7 +75,8 @@ fn tac(filenames: Vec, before: bool, _: bool, separator: &str) { if filename.as_slice() == "-" { box io::stdio::stdin_raw() as Box } else { - box crash_if_err!(1, io::File::open(&Path::new(filename))) as Box + let r = crash_if_err!(1, io::File::open(&Path::new(filename))); + box r as Box } ); let mut data = crash_if_err!(1, file.read_to_string()); diff --git a/src/uniq/uniq.rs b/src/uniq/uniq.rs index d082e6712..98fe7e2d1 100644 --- a/src/uniq/uniq.rs +++ b/src/uniq/uniq.rs @@ -196,7 +196,8 @@ fn open_input_file(in_file_name: String) -> io::BufferedReader + let r = crash_if_err!(1, in_file); + box r as Box }; io::BufferedReader::new(in_file) } @@ -207,7 +208,8 @@ fn open_output_file(out_file_name: String) -> io::BufferedWriter + let w = crash_if_err!(1, in_file); + box w as Box }; io::BufferedWriter::new(out_file) }