Skip to content

Commit

Permalink
Remove unneccessary use under cfg(unix)
Browse files Browse the repository at this point in the history
  • Loading branch information
popzxc committed Oct 21, 2019
1 parent a06b205 commit ae04dc8
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions src/libtest/helpers/concurrency.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,14 @@
//! during tests execution.
use std::env;

#[cfg(any(unix, target_os = "cloudabi"))]
use libc;

#[allow(deprecated)]
pub fn get_concurrency() -> usize {
return match env::var("RUST_TEST_THREADS") {
Ok(s) => {
let opt_n: Option<usize> = s.parse().ok();
match opt_n {
Some(n) if n > 0 => n,
_ => panic!(
"RUST_TEST_THREADS is `{}`, should be a positive integer.",
s
),
_ => panic!("RUST_TEST_THREADS is `{}`, should be a positive integer.", s),
}
}
Err(..) => num_cpus(),
Expand Down Expand Up @@ -82,11 +76,7 @@ pub fn get_concurrency() -> usize {
unsafe { libc::sysconf(libc::_SC_NPROCESSORS_ONLN) as usize }
}

#[cfg(any(
target_os = "freebsd",
target_os = "dragonfly",
target_os = "netbsd"
))]
#[cfg(any(target_os = "freebsd", target_os = "dragonfly", target_os = "netbsd"))]
fn num_cpus() -> usize {
use std::ptr;

Expand Down

0 comments on commit ae04dc8

Please sign in to comment.