Skip to content

Commit 91850d3

Browse files
surbangitbot
authored and
gitbot
committed
Implement code review
1 parent dfeb3ec commit 91850d3

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

std/src/sys/pal/wasi/thread.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -192,8 +192,7 @@ pub fn available_parallelism() -> io::Result<NonZero<usize>> {
192192
if #[cfg(target_feature = "atomics")] {
193193
match unsafe { libc::sysconf(libc::_SC_NPROCESSORS_ONLN) } {
194194
-1 => Err(io::Error::last_os_error()),
195-
0 => Err(io::Error::UNKNOWN_THREAD_COUNT),
196-
cpus => Ok(unsafe { NonZero::new_unchecked(cpus as usize) }),
195+
cpus => NonZero::new(cpus as usize).ok_or(io::Error::UNKNOWN_THREAD_COUNT),
197196
}
198197
} else {
199198
crate::sys::unsupported()

0 commit comments

Comments
 (0)