Skip to content

Commit b2f7393

Browse files
committed
Fix clippy::legacy_numeric_constants
1 parent 0e8d45d commit b2f7393

File tree

13 files changed

+8
-21
lines changed

13 files changed

+8
-21
lines changed

rayon-core/src/latch.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ use std::marker::PhantomData;
22
use std::ops::Deref;
33
use std::sync::atomic::{AtomicUsize, Ordering};
44
use std::sync::Arc;
5-
use std::usize;
65

76
use crate::registry::{Registry, WorkerThread};
87
use crate::sync::{Condvar, Mutex};

rayon-core/src/registry.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ use std::ptr;
1818
use std::sync::atomic::{AtomicUsize, Ordering};
1919
use std::sync::{Arc, Once};
2020
use std::thread;
21-
use std::usize;
2221

2322
/// Thread builder used for customization via
2423
/// [`ThreadPoolBuilder::spawn_handler`](struct.ThreadPoolBuilder.html#method.spawn_handler).
@@ -576,10 +575,7 @@ impl Registry {
576575
pub(super) fn increment_terminate_count(&self) {
577576
let previous = self.terminate_count.fetch_add(1, Ordering::AcqRel);
578577
debug_assert!(previous != 0, "registry ref count incremented from zero");
579-
assert!(
580-
previous != std::usize::MAX,
581-
"overflow in registry ref count"
582-
);
578+
assert!(previous != usize::MAX, "overflow in registry ref count");
583579
}
584580

585581
/// Signals that the thread-pool which owns this registry has been

rayon-core/src/sleep/counters.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ pub(super) struct Counters {
2727
pub(super) struct JobsEventCounter(usize);
2828

2929
impl JobsEventCounter {
30-
pub(super) const DUMMY: JobsEventCounter = JobsEventCounter(std::usize::MAX);
30+
pub(super) const DUMMY: JobsEventCounter = JobsEventCounter(usize::MAX);
3131

3232
#[inline]
3333
pub(super) fn as_usize(self) -> usize {

rayon-core/src/sleep/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ use crate::sync::{Condvar, Mutex};
66
use crossbeam_utils::CachePadded;
77
use std::sync::atomic::Ordering;
88
use std::thread;
9-
use std::usize;
109

1110
mod counters;
1211
pub(crate) use self::counters::THREADS_MAX;

rayon-demo/src/tsp/solver.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
use std::collections::BinaryHeap;
22
use std::sync::atomic::{AtomicUsize, Ordering};
33
use std::sync::{Arc, Mutex};
4-
use std::usize;
54

65
use super::graph::{Graph, Node};
76
use super::step;

rayon-demo/src/tsp/weight.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
use std::ops::{Add, AddAssign, Sub, SubAssign};
2-
use std::usize;
32

43
#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord)]
54
pub struct Weight {

src/iter/blocks.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ where
2727
// now we loop on each block size
2828
while remaining_len > 0 && !consumer.full() {
2929
// we compute the next block's size
30-
let size = self.sizes.next().unwrap_or(std::usize::MAX);
30+
let size = self.sizes.next().unwrap_or(usize::MAX);
3131
let capped_size = remaining_len.min(size);
3232
remaining_len -= capped_size;
3333

src/iter/enumerate.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ use super::plumbing::*;
22
use super::*;
33
use std::iter;
44
use std::ops::Range;
5-
use std::usize;
65

76
/// `Enumerate` is an iterator that returns the current count along with the element.
87
/// This struct is created by the [`enumerate()`] method on [`IndexedParallelIterator`]

src/iter/find_first_last/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ where
4343
I: ParallelIterator,
4444
P: Fn(&I::Item) -> bool + Sync,
4545
{
46-
let best_found = AtomicUsize::new(usize::max_value());
46+
let best_found = AtomicUsize::new(usize::MAX);
4747
let consumer = FindConsumer::new(&find_op, MatchPosition::Leftmost, &best_found);
4848
pi.drive_unindexed(consumer)
4949
}
@@ -71,7 +71,7 @@ impl<'p, P> FindConsumer<'p, P> {
7171
FindConsumer {
7272
find_op,
7373
lower_bound: Cell::new(0),
74-
upper_bound: usize::max_value(),
74+
upper_bound: usize::MAX,
7575
match_position,
7676
best_found,
7777
}

src/iter/plumbing/mod.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ use crate::join_context;
88

99
use super::IndexedParallelIterator;
1010

11-
use std::usize;
12-
1311
/// The `ProducerCallback` trait is a kind of generic closure,
1412
/// [analogous to `FnOnce`][FnOnce]. See [the corresponding section in
1513
/// the plumbing README][r] for more details.

0 commit comments

Comments
 (0)