From 61206c4293fdf256a0971d2effd87e5a874afbd7 Mon Sep 17 00:00:00 2001 From: Alexander Battisti Date: Mon, 9 Jan 2017 20:20:11 +0100 Subject: [PATCH 1/2] Fix for for setting test-threads to 0 Running test with cargo test -- --test-threads=0 causes cargo to hang as 0 is a valid usize. Adding zero threads as a special case to the error handling. --- src/libtest/lib.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/libtest/lib.rs b/src/libtest/lib.rs index 30c34746c34e4..568e86225a3c2 100644 --- a/src/libtest/lib.rs +++ b/src/libtest/lib.rs @@ -439,6 +439,8 @@ pub fn parse_opts(args: &[String]) -> Option { let test_threads = match matches.opt_str("test-threads") { Some(n_str) => match n_str.parse::() { + Ok(0) => + return Some(Err(format!("argument for --test-threads must not be 0"))), Ok(n) => Some(n), Err(e) => return Some(Err(format!("argument for --test-threads must be a number > 0 \ From 0a4c268a6b3e003e5339863c5be2f1b9d0c594de Mon Sep 17 00:00:00 2001 From: Alexander Battisti Date: Sat, 11 Feb 2017 20:04:05 +0100 Subject: [PATCH 2/2] removed trailing whitespace --- src/libtest/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libtest/lib.rs b/src/libtest/lib.rs index 568e86225a3c2..39a9ac8569ad0 100644 --- a/src/libtest/lib.rs +++ b/src/libtest/lib.rs @@ -439,7 +439,7 @@ pub fn parse_opts(args: &[String]) -> Option { let test_threads = match matches.opt_str("test-threads") { Some(n_str) => match n_str.parse::() { - Ok(0) => + Ok(0) => return Some(Err(format!("argument for --test-threads must not be 0"))), Ok(n) => Some(n), Err(e) =>