Skip to content

Commit 9016a08

Browse files
committed
Replace max/min_value() with MAX/MIN assoc consts
1 parent 410137d commit 9016a08

File tree

8 files changed

+15
-15
lines changed

8 files changed

+15
-15
lines changed

src/liballoc/slice.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,7 @@ impl<T> [T] {
432432
///
433433
/// ```should_panic
434434
/// // this will panic at runtime
435-
/// b"0123456789abcdef".repeat(usize::max_value());
435+
/// b"0123456789abcdef".repeat(usize::MAX);
436436
/// ```
437437
#[stable(feature = "repeat_generic_slice", since = "1.40.0")]
438438
pub fn repeat(&self, n: usize) -> Vec<T>

src/liballoc/str.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -499,7 +499,7 @@ impl str {
499499
///
500500
/// ```should_panic
501501
/// // this will panic at runtime
502-
/// "0123456789abcdef".repeat(usize::max_value());
502+
/// "0123456789abcdef".repeat(usize::MAX);
503503
/// ```
504504
#[stable(feature = "repeat_str", since = "1.16.0")]
505505
pub fn repeat(&self, n: usize) -> String {

src/libcore/fmt/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -852,7 +852,7 @@ pub trait LowerHex {
852852
/// }
853853
/// }
854854
///
855-
/// let l = Length(i32::max_value());
855+
/// let l = Length(i32::MAX);
856856
///
857857
/// assert_eq!(format!("l as hex is: {:X}", l), "l as hex is: 7FFFFFFF");
858858
///

src/libcore/intrinsics.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1731,19 +1731,19 @@ extern "rust-intrinsic" {
17311731
pub fn mul_with_overflow<T>(x: T, y: T) -> (T, bool);
17321732

17331733
/// Performs an exact division, resulting in undefined behavior where
1734-
/// `x % y != 0` or `y == 0` or `x == T::min_value() && y == -1`
1734+
/// `x % y != 0` or `y == 0` or `x == T::MIN && y == -1`
17351735
pub fn exact_div<T>(x: T, y: T) -> T;
17361736

17371737
/// Performs an unchecked division, resulting in undefined behavior
1738-
/// where y = 0 or x = `T::min_value()` and y = -1
1738+
/// where y = 0 or x = `T::MIN` and y = -1
17391739
///
17401740
/// The stabilized versions of this intrinsic are available on the integer
17411741
/// primitives via the `checked_div` method. For example,
17421742
/// [`std::u32::checked_div`](../../std/primitive.u32.html#method.checked_div)
17431743
#[rustc_const_unstable(feature = "const_int_unchecked_arith", issue = "none")]
17441744
pub fn unchecked_div<T>(x: T, y: T) -> T;
17451745
/// Returns the remainder of an unchecked division, resulting in
1746-
/// undefined behavior where y = 0 or x = `T::min_value()` and y = -1
1746+
/// undefined behavior where y = 0 or x = `T::MIN` and y = -1
17471747
///
17481748
/// The stabilized versions of this intrinsic are available on the integer
17491749
/// primitives via the `checked_rem` method. For example,
@@ -1769,17 +1769,17 @@ extern "rust-intrinsic" {
17691769
pub fn unchecked_shr<T>(x: T, y: T) -> T;
17701770

17711771
/// Returns the result of an unchecked addition, resulting in
1772-
/// undefined behavior when `x + y > T::max_value()` or `x + y < T::min_value()`.
1772+
/// undefined behavior when `x + y > T::MAX` or `x + y < T::MIN`.
17731773
#[rustc_const_unstable(feature = "const_int_unchecked_arith", issue = "none")]
17741774
pub fn unchecked_add<T>(x: T, y: T) -> T;
17751775

17761776
/// Returns the result of an unchecked subtraction, resulting in
1777-
/// undefined behavior when `x - y > T::max_value()` or `x - y < T::min_value()`.
1777+
/// undefined behavior when `x - y > T::MAX` or `x - y < T::MIN`.
17781778
#[rustc_const_unstable(feature = "const_int_unchecked_arith", issue = "none")]
17791779
pub fn unchecked_sub<T>(x: T, y: T) -> T;
17801780

17811781
/// Returns the result of an unchecked multiplication, resulting in
1782-
/// undefined behavior when `x * y > T::max_value()` or `x * y < T::min_value()`.
1782+
/// undefined behavior when `x * y > T::MAX` or `x * y < T::MIN`.
17831783
#[rustc_const_unstable(feature = "const_int_unchecked_arith", issue = "none")]
17841784
pub fn unchecked_mul<T>(x: T, y: T) -> T;
17851785

src/libcore/iter/traits/iterator.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ pub trait Iterator {
198198
/// // and the maximum possible lower bound
199199
/// let iter = 0..;
200200
///
201-
/// assert_eq!((usize::max_value(), None), iter.size_hint());
201+
/// assert_eq!((usize::MAX, None), iter.size_hint());
202202
/// ```
203203
#[inline]
204204
#[stable(feature = "rust1", since = "1.0.0")]

src/libcore/ptr/const_ptr.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -659,8 +659,8 @@ impl<T: ?Sized> *const T {
659659
/// `align`.
660660
///
661661
/// If it is not possible to align the pointer, the implementation returns
662-
/// `usize::max_value()`. It is permissible for the implementation to *always*
663-
/// return `usize::max_value()`. Only your algorithm's performance can depend
662+
/// `usize::MAX`. It is permissible for the implementation to *always*
663+
/// return `usize::MAX`. Only your algorithm's performance can depend
664664
/// on getting a usable offset here, not its correctness.
665665
///
666666
/// The offset is expressed in number of `T` elements, and not bytes. The value returned can be

src/libcore/ptr/mut_ptr.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -847,8 +847,8 @@ impl<T: ?Sized> *mut T {
847847
/// `align`.
848848
///
849849
/// If it is not possible to align the pointer, the implementation returns
850-
/// `usize::max_value()`. It is permissible for the implementation to *always*
851-
/// return `usize::max_value()`. Only your algorithm's performance can depend
850+
/// `usize::MAX`. It is permissible for the implementation to *always*
851+
/// return `usize::MAX`. Only your algorithm's performance can depend
852852
/// on getting a usable offset here, not its correctness.
853853
///
854854
/// The offset is expressed in number of `T` elements, and not bytes. The value returned can be

src/librustc_target/abi/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -577,7 +577,7 @@ pub struct Scalar {
577577
pub value: Primitive,
578578

579579
/// Inclusive wrap-around range of valid values, that is, if
580-
/// start > end, it represents `start..=max_value()`,
580+
/// start > end, it represents `start..=MAX`,
581581
/// followed by `0..=end`.
582582
///
583583
/// That is, for an i8 primitive, a range of `254..=2` means following

0 commit comments

Comments
 (0)