Skip to content

Commit 5f1709b

Browse files
committed
Use prelude Ord::min/max instead of from cmp
(cherry picked from commit f3dbb42)
1 parent 2a25b53 commit 5f1709b

File tree

3 files changed

+4
-5
lines changed

3 files changed

+4
-5
lines changed

rayon-core/src/scope/test.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ use crate::ThreadPoolBuilder;
33
use crate::{scope, scope_fifo, Scope, ScopeFifo};
44
use rand::{Rng, SeedableRng};
55
use rand_xorshift::XorShiftRng;
6-
use std::cmp;
76
use std::iter::once;
87
use std::sync::atomic::{AtomicUsize, Ordering};
98
use std::sync::{Barrier, Mutex};
@@ -182,7 +181,7 @@ fn the_final_countdown<'scope>(
182181
let diff = if p > q { p - q } else { q - p };
183182

184183
let mut data = max.lock().unwrap();
185-
*data = cmp::max(diff, *data);
184+
*data = Ord::max(diff, *data);
186185

187186
if n > 0 {
188187
s.spawn(move |s| the_final_countdown(s, bottom_of_stack, max, n - 1));

rayon-core/src/sleep/counters.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ impl AtomicCounters {
166166
// Current heuristic: whenever an inactive thread goes away, if
167167
// there are any sleeping threads, wake 'em up.
168168
let sleeping_threads = old_value.sleeping_threads();
169-
std::cmp::min(sleeping_threads, 2)
169+
Ord::min(sleeping_threads, 2)
170170
}
171171

172172
/// Subtracts a sleeping thread. This cannot fail, but it is only

rayon-core/src/sleep/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -328,10 +328,10 @@ impl Sleep {
328328
// -- clearly the existing idle jobs aren't enough. Otherwise,
329329
// check to see if we have enough idle workers.
330330
if !queue_was_empty {
331-
let num_to_wake = std::cmp::min(num_jobs, num_sleepers);
331+
let num_to_wake = Ord::min(num_jobs, num_sleepers);
332332
self.wake_any_threads(num_to_wake);
333333
} else if num_awake_but_idle < num_jobs {
334-
let num_to_wake = std::cmp::min(num_jobs - num_awake_but_idle, num_sleepers);
334+
let num_to_wake = Ord::min(num_jobs - num_awake_but_idle, num_sleepers);
335335
self.wake_any_threads(num_to_wake);
336336
}
337337
}

0 commit comments

Comments
 (0)