File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -138,7 +138,7 @@ where
138138#[ cfg( target_os = "linux" ) ]
139139pub ( 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 }
You can’t perform that action at this time.
0 commit comments