From cab466d678ff3d350f7b613d44140a013c107794 Mon Sep 17 00:00:00 2001 From: Michael Gehring Date: Sun, 31 Aug 2014 19:31:53 +0200 Subject: [PATCH 1/3] Update rust-crypto --- deps/rust-crypto | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deps/rust-crypto b/deps/rust-crypto index 24f91a819..44317cac3 160000 --- a/deps/rust-crypto +++ b/deps/rust-crypto @@ -1 +1 @@ -Subproject commit 24f91a8194440af39a017ef25a13c1db1d4a8f4f +Subproject commit 44317cac3c4b36a95ebd5654acbf0e1fff9c4b2e From cdacaaa648ef9d8c7d196f40549b8f35e92facc9 Mon Sep 17 00:00:00 2001 From: Michael Gehring Date: Sun, 31 Aug 2014 19:45:03 +0200 Subject: [PATCH 2/3] time::Duration::{milli}seconds now takes i64 arg --- src/sleep/sleep.rs | 3 +-- src/tail/tail.rs | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/sleep/sleep.rs b/src/sleep/sleep.rs index 9be872d8a..cf18d104a 100644 --- a/src/sleep/sleep.rs +++ b/src/sleep/sleep.rs @@ -80,8 +80,7 @@ fn sleep(args: Vec) { let sleep_dur = if sleep_time == f64::INFINITY { duration::MAX } else { - let (days, secs, millis) = (sleep_time / 86400., sleep_time % 86400., (sleep_time * 1_000.) % 1_000.); - Duration::days(days as i32) + Duration::seconds(secs as i32) + Duration::milliseconds(millis as i32) + Duration::seconds(sleep_time as i64) }; timer::sleep(sleep_dur); } diff --git a/src/tail/tail.rs b/src/tail/tail.rs index 5fb9d0fb2..e40a36d4f 100644 --- a/src/tail/tail.rs +++ b/src/tail/tail.rs @@ -170,8 +170,7 @@ fn tail (reader: &mut BufferedReader, line_count:uint, follow:bool // if we follow the file, sleep a bit and print the rest if the file has grown. while follow { - let (days, secs, millis) = ((sleep_msec / 1000) / 86400, (sleep_msec / 1000) % 86400, sleep_msec % 1000); - sleep(Duration::days(days as i32) + Duration::seconds(secs as i32) + Duration::milliseconds(millis as i32)); + sleep(Duration::milliseconds(sleep_msec as i64)); for io_line in reader.lines() { match io_line { Ok(line) => print!("{}", line), From 1c8e9161cc4c9277467e5b3c7567a3a8b3d4efe5 Mon Sep 17 00:00:00 2001 From: Michael Gehring Date: Sun, 31 Aug 2014 20:01:41 +0200 Subject: [PATCH 3/3] Add explicit lifetimes --- src/expand/expand.rs | 2 +- src/hashsum/hashsum.rs | 4 ++-- src/unexpand/unexpand.rs | 2 +- src/uniq/uniq.rs | 4 ++-- src/wc/wc.rs | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/expand/expand.rs b/src/expand/expand.rs index dbd90f14d..8c32490e4 100644 --- a/src/expand/expand.rs +++ b/src/expand/expand.rs @@ -105,7 +105,7 @@ pub fn uumain(args: Vec) -> int { return 0; } -fn open(path: String) -> io::BufferedReader> { +fn open(path: String) -> io::BufferedReader> { let mut file_buf; if path.as_slice() == "-" { io::BufferedReader::new(box io::stdio::stdin_raw() as Box) diff --git a/src/hashsum/hashsum.rs b/src/hashsum/hashsum.rs index 7557eb54f..7df564448 100644 --- a/src/hashsum/hashsum.rs +++ b/src/hashsum/hashsum.rs @@ -59,7 +59,7 @@ fn get_algo_opts(program: &str) -> Vec { } } -fn detect_algo(program: &str, matches: &getopts::Matches) -> (&'static str, Box) { +fn detect_algo(program: &str, matches: &getopts::Matches) -> (&'static str, Box) { let mut alg: Option> = None; let mut name: &'static str = ""; match program { @@ -71,7 +71,7 @@ fn detect_algo(program: &str, matches: &getopts::Matches) -> (&'static str, Box< "sha512sum" => ("SHA512", box Sha512::new() as Box), _ => { { - let set_or_crash = |n: &'static str, val: Box| -> () { + let set_or_crash = |n, val| -> () { if alg.is_some() { crash!(1, "You cannot combine multiple hash algorithms!") }; name = n; alg = Some(val); diff --git a/src/unexpand/unexpand.rs b/src/unexpand/unexpand.rs index 47fd813eb..1c13edd15 100644 --- a/src/unexpand/unexpand.rs +++ b/src/unexpand/unexpand.rs @@ -107,7 +107,7 @@ pub fn uumain(args: Vec) -> int { return 0; } -fn open(path: String) -> io::BufferedReader> { +fn open(path: String) -> io::BufferedReader> { let mut file_buf; if path.as_slice() == "-" { io::BufferedReader::new(box io::stdio::stdin_raw() as Box) diff --git a/src/uniq/uniq.rs b/src/uniq/uniq.rs index db63bcd08..e95961666 100644 --- a/src/uniq/uniq.rs +++ b/src/uniq/uniq.rs @@ -190,7 +190,7 @@ pub fn uumain(args: Vec) -> int { 0 } -fn open_input_file(in_file_name: String) -> io::BufferedReader> { +fn open_input_file(in_file_name: String) -> io::BufferedReader> { let in_file = if in_file_name.as_slice() == "-" { box io::stdio::stdin_raw() as Box } else { @@ -201,7 +201,7 @@ fn open_input_file(in_file_name: String) -> io::BufferedReader> { io::BufferedReader::new(in_file) } -fn open_output_file(out_file_name: String) -> io::BufferedWriter> { +fn open_output_file(out_file_name: String) -> io::BufferedWriter> { let out_file = if out_file_name.as_slice() == "-" { box io::stdio::stdout_raw() as Box } else { diff --git a/src/wc/wc.rs b/src/wc/wc.rs index 4877c9930..a6cb9499d 100644 --- a/src/wc/wc.rs +++ b/src/wc/wc.rs @@ -230,7 +230,7 @@ fn print_stats(filename: &str, line_count: uint, word_count: uint, char_count: u } } -fn open(path: String) -> StdResult>, int> { +fn open(path: String) -> StdResult>, int> { if "-" == path.as_slice() { let reader = box stdin_raw() as Box; return Ok(BufferedReader::new(reader));