Skip to content

Commit 6ef8a13

Browse files
committed
[runtime] cleanup
1 parent d6bdfdf commit 6ef8a13

1 file changed

Lines changed: 3 additions & 6 deletions

File tree

runtime/src/utils/thread.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ where
138138
#[cfg(target_os = "linux")]
139139
pub(crate) fn available_cpus() -> Option<NonEmptyVec<usize>> {
140140
let word_bits = libc::c_ulong::BITS as usize;
141-
let mut words = 1usize;
141+
let mut words = 1;
142142

143143
// Probe `sched_getaffinity` with an exponentially growing buffer until the
144144
// kernel either accepts it or reports a non-retryable error.
@@ -169,12 +169,9 @@ pub(crate) fn available_cpus() -> Option<NonEmptyVec<usize>> {
169169
// larger buffer. Cap the probe size so invalid environments
170170
// cannot force unbounded growth.
171171
words = words.checked_mul(2)?;
172-
if words
172+
words
173173
.checked_mul(word_bits)
174-
.is_none_or(|bits| bits > MAX_AFFINITY_CPUS)
175-
{
176-
return None;
177-
}
174+
.map(|bits| bits > MAX_AFFINITY_CPUS)?;
178175
}
179176
_ => return None,
180177
}

0 commit comments

Comments
 (0)