@@ -750,9 +750,9 @@ $EndFeature, "
750750 }
751751
752752 doc_comment! {
753- concat!( "Unchecked integer addition. Computes `self + rhs, assuming overflow
753+ concat!( "Unchecked integer addition. Computes `self + rhs` , assuming overflow
754754cannot occur. This results in undefined behavior when `self + rhs > " , stringify!( $SelfT) ,
755- "::max_value() ` or `self + rhs < " , stringify!( $SelfT) , "::min_value() `." ) ,
755+ "::MAX ` or `self + rhs < " , stringify!( $SelfT) , "::MIN `." ) ,
756756 #[ unstable(
757757 feature = "unchecked_math" ,
758758 reason = "niche optimization path" ,
@@ -792,9 +792,9 @@ $EndFeature, "
792792 }
793793
794794 doc_comment! {
795- concat!( "Unchecked integer subtraction. Computes `self - rhs, assuming overflow
795+ concat!( "Unchecked integer subtraction. Computes `self - rhs` , assuming overflow
796796cannot occur. This results in undefined behavior when `self - rhs > " , stringify!( $SelfT) ,
797- "::max_value() ` or `self - rhs < " , stringify!( $SelfT) , "::min_value() `." ) ,
797+ "::MAX ` or `self - rhs < " , stringify!( $SelfT) , "::MIN `." ) ,
798798 #[ unstable(
799799 feature = "unchecked_math" ,
800800 reason = "niche optimization path" ,
@@ -834,9 +834,9 @@ $EndFeature, "
834834 }
835835
836836 doc_comment! {
837- concat!( "Unchecked integer multiplication. Computes `self * rhs, assuming overflow
837+ concat!( "Unchecked integer multiplication. Computes `self * rhs` , assuming overflow
838838cannot occur. This results in undefined behavior when `self * rhs > " , stringify!( $SelfT) ,
839- "::max_value() ` or `self * rhs < " , stringify!( $SelfT) , "::min_value() `." ) ,
839+ "::MAX ` or `self * rhs < " , stringify!( $SelfT) , "::MIN `." ) ,
840840 #[ unstable(
841841 feature = "unchecked_math" ,
842842 reason = "niche optimization path" ,
@@ -871,7 +871,7 @@ $EndFeature, "
871871 without modifying the original"]
872872 #[ inline]
873873 pub const fn checked_div( self , rhs: Self ) -> Option <Self > {
874- if rhs == 0 || ( self == Self :: min_value ( ) && rhs == -1 ) {
874+ if rhs == 0 || ( self == Self :: MIN && rhs == -1 ) {
875875 None
876876 } else {
877877 // SAFETY: div by zero and by INT_MIN have been checked above
@@ -900,7 +900,7 @@ assert_eq!((1", stringify!($SelfT), ").checked_div_euclid(0), None);
900900 without modifying the original"]
901901 #[ inline]
902902 pub const fn checked_div_euclid( self , rhs: Self ) -> Option <Self > {
903- if rhs == 0 || ( self == Self :: min_value ( ) && rhs == -1 ) {
903+ if rhs == 0 || ( self == Self :: MIN && rhs == -1 ) {
904904 None
905905 } else {
906906 Some ( self . div_euclid( rhs) )
@@ -929,7 +929,7 @@ $EndFeature, "
929929 without modifying the original"]
930930 #[ inline]
931931 pub const fn checked_rem( self , rhs: Self ) -> Option <Self > {
932- if rhs == 0 || ( self == Self :: min_value ( ) && rhs == -1 ) {
932+ if rhs == 0 || ( self == Self :: MIN && rhs == -1 ) {
933933 None
934934 } else {
935935 // SAFETY: div by zero and by INT_MIN have been checked above
@@ -957,7 +957,7 @@ assert_eq!(", stringify!($SelfT), "::MIN.checked_rem_euclid(-1), None);
957957 without modifying the original"]
958958 #[ inline]
959959 pub const fn checked_rem_euclid( self , rhs: Self ) -> Option <Self > {
960- if rhs == 0 || ( self == Self :: min_value ( ) && rhs == -1 ) {
960+ if rhs == 0 || ( self == Self :: MIN && rhs == -1 ) {
961961 None
962962 } else {
963963 Some ( self . rem_euclid( rhs) )
@@ -1236,9 +1236,9 @@ $EndFeature, "
12361236 match self . checked_mul( rhs) {
12371237 Some ( x) => x,
12381238 None => if ( self < 0 ) == ( rhs < 0 ) {
1239- Self :: max_value ( )
1239+ Self :: MAX
12401240 } else {
1241- Self :: min_value ( )
1241+ Self :: MIN
12421242 }
12431243 }
12441244 }
@@ -1267,8 +1267,8 @@ $EndFeature, "
12671267 pub const fn saturating_pow( self , exp: u32 ) -> Self {
12681268 match self . checked_pow( exp) {
12691269 Some ( x) => x,
1270- None if self < 0 && exp % 2 == 1 => Self :: min_value ( ) ,
1271- None => Self :: max_value ( ) ,
1270+ None if self < 0 && exp % 2 == 1 => Self :: MIN ,
1271+ None => Self :: MAX ,
12721272 }
12731273 }
12741274 }
@@ -1738,7 +1738,7 @@ $EndFeature, "
17381738 #[ must_use = "this returns the result of the operation, \
17391739 without modifying the original"]
17401740 pub const fn overflowing_div( self , rhs: Self ) -> ( Self , bool ) {
1741- if self == Self :: min_value ( ) && rhs == -1 {
1741+ if self == Self :: MIN && rhs == -1 {
17421742 ( self , true )
17431743 } else {
17441744 ( self / rhs, false )
@@ -1771,7 +1771,7 @@ assert_eq!(", stringify!($SelfT), "::MIN.overflowing_div_euclid(-1), (", stringi
17711771 #[ must_use = "this returns the result of the operation, \
17721772 without modifying the original"]
17731773 pub const fn overflowing_div_euclid( self , rhs: Self ) -> ( Self , bool ) {
1774- if self == Self :: min_value ( ) && rhs == -1 {
1774+ if self == Self :: MIN && rhs == -1 {
17751775 ( self , true )
17761776 } else {
17771777 ( self . div_euclid( rhs) , false )
@@ -1805,7 +1805,7 @@ $EndFeature, "
18051805 #[ must_use = "this returns the result of the operation, \
18061806 without modifying the original"]
18071807 pub const fn overflowing_rem( self , rhs: Self ) -> ( Self , bool ) {
1808- if self == Self :: min_value ( ) && rhs == -1 {
1808+ if self == Self :: MIN && rhs == -1 {
18091809 ( 0 , true )
18101810 } else {
18111811 ( self % rhs, false )
@@ -1838,7 +1838,7 @@ assert_eq!(", stringify!($SelfT), "::MIN.overflowing_rem_euclid(-1), (0, true));
18381838 without modifying the original"]
18391839 #[ inline]
18401840 pub const fn overflowing_rem_euclid( self , rhs: Self ) -> ( Self , bool ) {
1841- if self == Self :: min_value ( ) && rhs == -1 {
1841+ if self == Self :: MIN && rhs == -1 {
18421842 ( 0 , true )
18431843 } else {
18441844 ( self . rem_euclid( rhs) , false )
@@ -1869,8 +1869,8 @@ assert_eq!(", stringify!($SelfT), "::MIN.overflowing_neg(), (", stringify!($Self
18691869 #[ allow( unused_attributes) ]
18701870 #[ allow_internal_unstable( const_if_match) ]
18711871 pub const fn overflowing_neg( self ) -> ( Self , bool ) {
1872- if self == Self :: min_value ( ) {
1873- ( Self :: min_value ( ) , true )
1872+ if self == Self :: MIN {
1873+ ( Self :: MIN , true )
18741874 } else {
18751875 ( -self , false )
18761876 }
@@ -1952,7 +1952,7 @@ $EndFeature, "
19521952 #[ rustc_const_stable( feature = "const_int_methods" , since = "1.32.0" ) ]
19531953 #[ inline]
19541954 pub const fn overflowing_abs( self ) -> ( Self , bool ) {
1955- ( self . wrapping_abs( ) , self == Self :: min_value ( ) )
1955+ ( self . wrapping_abs( ) , self == Self :: MIN )
19561956 }
19571957 }
19581958
@@ -2986,9 +2986,9 @@ assert_eq!((", stringify!($SelfT), "::MAX - 2).checked_add(3), None);", $EndFeat
29862986 }
29872987
29882988 doc_comment! {
2989- concat!( "Unchecked integer addition. Computes `self + rhs, assuming overflow
2989+ concat!( "Unchecked integer addition. Computes `self + rhs` , assuming overflow
29902990cannot occur. This results in undefined behavior when `self + rhs > " , stringify!( $SelfT) ,
2991- "::max_value() ` or `self + rhs < " , stringify!( $SelfT) , "::min_value() `." ) ,
2991+ "::MAX ` or `self + rhs < " , stringify!( $SelfT) , "::MIN `." ) ,
29922992 #[ unstable(
29932993 feature = "unchecked_math" ,
29942994 reason = "niche optimization path" ,
@@ -3026,9 +3026,9 @@ assert_eq!(0", stringify!($SelfT), ".checked_sub(1), None);", $EndFeature, "
30263026 }
30273027
30283028 doc_comment! {
3029- concat!( "Unchecked integer subtraction. Computes `self - rhs, assuming overflow
3029+ concat!( "Unchecked integer subtraction. Computes `self - rhs` , assuming overflow
30303030cannot occur. This results in undefined behavior when `self - rhs > " , stringify!( $SelfT) ,
3031- "::max_value() ` or `self - rhs < " , stringify!( $SelfT) , "::min_value() `." ) ,
3031+ "::MAX ` or `self - rhs < " , stringify!( $SelfT) , "::MIN `." ) ,
30323032 #[ unstable(
30333033 feature = "unchecked_math" ,
30343034 reason = "niche optimization path" ,
@@ -3066,9 +3066,9 @@ assert_eq!(", stringify!($SelfT), "::MAX.checked_mul(2), None);", $EndFeature, "
30663066 }
30673067
30683068 doc_comment! {
3069- concat!( "Unchecked integer multiplication. Computes `self * rhs, assuming overflow
3069+ concat!( "Unchecked integer multiplication. Computes `self * rhs` , assuming overflow
30703070cannot occur. This results in undefined behavior when `self * rhs > " , stringify!( $SelfT) ,
3071- "::max_value() ` or `self * rhs < " , stringify!( $SelfT) , "::min_value() `." ) ,
3071+ "::MAX ` or `self * rhs < " , stringify!( $SelfT) , "::MIN `." ) ,
30723072 #[ unstable(
30733073 feature = "unchecked_math" ,
30743074 reason = "niche optimization path" ,
@@ -3367,7 +3367,7 @@ assert_eq!((", stringify!($SelfT), "::MAX).saturating_mul(10), ", stringify!($Se
33673367 pub const fn saturating_mul( self , rhs: Self ) -> Self {
33683368 match self . checked_mul( rhs) {
33693369 Some ( x) => x,
3370- None => Self :: max_value ( ) ,
3370+ None => Self :: MAX ,
33713371 }
33723372 }
33733373 }
@@ -3394,7 +3394,7 @@ $EndFeature, "
33943394 pub const fn saturating_pow( self , exp: u32 ) -> Self {
33953395 match self . checked_pow( exp) {
33963396 Some ( x) => x,
3397- None => Self :: max_value ( ) ,
3397+ None => Self :: MAX ,
33983398 }
33993399 }
34003400 }
@@ -4081,7 +4081,7 @@ Basic usage:
40814081 }
40824082 }
40834083
4084- doc_comment! {
4084+ doc_comment! {
40854085 concat!( "Performs Euclidean division.
40864086
40874087Since, for the positive integers, all common
@@ -4179,7 +4179,7 @@ assert!(!10", stringify!($SelfT), ".is_power_of_two());", $EndFeature, "
41794179 // (such as intel pre-haswell) have more efficient ctlz
41804180 // intrinsics when the argument is non-zero.
41814181 let z = unsafe { intrinsics:: ctlz_nonzero( p) } ;
4182- <$SelfT>:: max_value ( ) >> z
4182+ <$SelfT>:: MAX >> z
41834183 }
41844184
41854185 doc_comment! {
@@ -5161,9 +5161,9 @@ trait FromStrRadixHelper: PartialOrd + Copy {
51615161macro_rules! doit {
51625162 ( $( $t: ty) * ) => ( $( impl FromStrRadixHelper for $t {
51635163 #[ inline]
5164- fn min_value( ) -> Self { Self :: min_value ( ) }
5164+ fn min_value( ) -> Self { Self :: MIN }
51655165 #[ inline]
5166- fn max_value( ) -> Self { Self :: max_value ( ) }
5166+ fn max_value( ) -> Self { Self :: MAX }
51675167 #[ inline]
51685168 fn from_u32( u: u32 ) -> Self { u as Self }
51695169 #[ inline]
0 commit comments