-
Notifications
You must be signed in to change notification settings - Fork 1.7k
tests: use std::thread::available_parallelism() instead of num_cpus to get thread count #8491
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
r? @flip1995 (rust-highfive has picked a reviewer for you, use r? to override) |
Note that this also returns thread count and not physical core count on my system (as did the previous implementation using num_cpus) |
tests/compile-test.rs
Outdated
match std::thread::available_parallelism() { | ||
Ok(threads) => threads.get(), | ||
_ => 1, | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't that be the same as
match std::thread::available_parallelism() { | |
Ok(threads) => threads.get(), | |
_ => 1, | |
} | |
std::thread::available_parallelism().map_or(1, |t| t.get()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To map_or
not to map
, that is the question!
Yeah, should be identical, thanks :D
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also apparently we don't have a lint for that yet :P
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
…o get thread count removes the dependency added in rust-lang#8451
175de93
to
7a15061
Compare
I really like what GitHub did to the formatting of the PR title 😄 @bors r+ Thanks! |
📌 Commit 7a15061 has been approved by |
☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test |
removes the dependency added in #8451
Please write a short comment explaining your change (or "none" for internal only changes)
changelog: tests: use std::thread::available_parallelism() instead of num_cpus to get thread count