Skip to content

Commit 4853d16

Browse files
committed
Use *::MAX associated constants
1 parent 76717e0 commit 4853d16

File tree

7 files changed

+8
-9
lines changed

7 files changed

+8
-9
lines changed

futures-channel/src/mpsc/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -297,13 +297,13 @@ struct State {
297297
}
298298

299299
// The `is_open` flag is stored in the left-most bit of `Inner::state`
300-
const OPEN_MASK: usize = usize::max_value() - (usize::max_value() >> 1);
300+
const OPEN_MASK: usize = usize::MAX - (usize::MAX >> 1);
301301

302302
// When a new channel is created, it is created in the open state with no
303303
// pending messages.
304304
const INIT_STATE: usize = OPEN_MASK;
305305

306-
// The maximum number of messages that a channel can track is `usize::max_value() >> 1`
306+
// The maximum number of messages that a channel can track is `usize::MAX >> 1`
307307
const MAX_CAPACITY: usize = !(OPEN_MASK);
308308

309309
// The maximum requested buffer size must be less than the maximum capacity of

futures-util/src/future/future/shared.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ const POLLING: usize = 1;
8282
const COMPLETE: usize = 2;
8383
const POISONED: usize = 3;
8484

85-
const NULL_WAKER_KEY: usize = usize::max_value();
85+
const NULL_WAKER_KEY: usize = usize::MAX;
8686

8787
impl<Fut: Future> Shared<Fut> {
8888
pub(super) fn new(future: Fut) -> Self {

futures-util/src/io/buf_reader.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ impl<R: AsyncRead + AsyncSeek> AsyncSeek for BufReader<R> {
211211
// it should be safe to assume that remainder fits within an i64 as the alternative
212212
// means we managed to allocate 8 exbibytes and that's absurd.
213213
// But it's not out of the realm of possibility for some weird underlying reader to
214-
// support seeking by i64::min_value() so we need to handle underflow when subtracting
214+
// support seeking by i64::MIN so we need to handle underflow when subtracting
215215
// remainder.
216216
if let Some(offset) = n.checked_sub(remainder) {
217217
result =

futures-util/src/stream/repeat.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ where
4444
}
4545

4646
fn size_hint(&self) -> (usize, Option<usize>) {
47-
(usize::max_value(), None)
47+
(usize::MAX, None)
4848
}
4949
}
5050

futures-util/src/stream/repeat_with.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ impl<A, F: FnMut() -> A> Stream for RepeatWith<F> {
2424
}
2525

2626
fn size_hint(&self) -> (usize, Option<usize>) {
27-
(usize::max_value(), None)
27+
(usize::MAX, None)
2828
}
2929
}
3030

futures-util/src/stream/stream/cycle.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
use core::pin::Pin;
2-
use core::usize;
32
use futures_core::ready;
43
use futures_core::stream::{FusedStream, Stream};
54
use futures_core::task::{Context, Poll};
@@ -48,7 +47,7 @@ where
4847
match self.orig.size_hint() {
4948
size @ (0, Some(0)) => size,
5049
(0, _) => (0, None),
51-
_ => (usize::max_value(), None),
50+
_ => (usize::MAX, None),
5251
}
5352
}
5453
}

futures-util/src/stream/stream/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ pub trait StreamExt: Stream {
336336
/// # Overflow Behavior
337337
///
338338
/// The method does no guarding against overflows, so enumerating more than
339-
/// [`prim@usize::max_value()`] elements either produces the wrong result or panics. If
339+
/// [`usize::MAX`] elements either produces the wrong result or panics. If
340340
/// debug assertions are enabled, a panic is guaranteed.
341341
///
342342
/// # Panics

0 commit comments

Comments
 (0)