diff options
author | Casper Beyer <caspervonb@pm.me> | 2021-04-30 20:57:42 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-30 08:57:42 -0400 |
commit | f31ee8d1bfc50de6cef5b746f6fd6431b7b772e5 (patch) | |
tree | db50356945325ee93248795da46d29a095f03e32 | |
parent | 4e6790a5fadff58d941916a90b78b43d9ab877aa (diff) |
fix(test): default to num cpus when no value is given (#10443)
-rw-r--r-- | Cargo.lock | 1 | ||||
-rw-r--r-- | cli/Cargo.toml | 1 | ||||
-rw-r--r-- | cli/flags.rs | 5 |
3 files changed, 4 insertions, 3 deletions
diff --git a/Cargo.lock b/Cargo.lock index 86a873675..222c61988 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -540,6 +540,7 @@ dependencies = [ "lspower", "nix", "notify", + "num_cpus", "os_pipe", "percent-encoding", "pin-project", diff --git a/cli/Cargo.toml b/cli/Cargo.toml index 707c3ec6e..f561b74e2 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -56,6 +56,7 @@ libc = "0.2.93" log = { version = "0.4.14", features = ["serde"] } lspower = "1.0.0" notify = "5.0.0-pre.7" +num_cpus = "1.13.0" percent-encoding = "2.1.0" pin-project = "1.0.6" regex = "1.4.3" diff --git a/cli/flags.rs b/cli/flags.rs index 3e63f8014..0c916ecb8 100644 --- a/cli/flags.rs +++ b/cli/flags.rs @@ -1683,9 +1683,8 @@ fn test_parse(flags: &mut Flags, matches: &clap::ArgMatches) { if let Some(value) = matches.value_of("jobs") { value.parse().unwrap() } else { - // TODO(caspervonb) when no value is given use - // https://doc.rust-lang.org/std/thread/fn.available_concurrency.html - 2 + // TODO(caspervonb) drop the dependency on num_cpus when https://doc.rust-lang.org/std/thread/fn.available_concurrency.html becomes stable. + num_cpus::get() } } else { 1 |