@@ -501,12 +501,37 @@ macro_rules! nonzero_integer_signedness_dependent_impls {
501
501
502
502
#[ rustfmt:: skip] // https://github.com/rust-lang/rustfmt/issues/5974
503
503
macro_rules! nonzero_integer_signedness_dependent_methods {
504
- // Methods for unsigned nonzero types only.
504
+ // Associated items for unsigned nonzero types only.
505
505
(
506
506
Self = $Ty: ident,
507
507
Primitive = unsigned $Int: ident,
508
508
UnsignedPrimitive = $Uint: ty,
509
509
) => {
510
+ /// The smallest value that can be represented by this non-zero
511
+ /// integer type, 1.
512
+ ///
513
+ /// # Examples
514
+ ///
515
+ /// ```
516
+ #[ doc = concat!( "# use std::num::" , stringify!( $Ty) , ";" ) ]
517
+ #[ doc = concat!( "assert_eq!(" , stringify!( $Ty) , "::MIN.get(), 1" , stringify!( $Int) , ");" ) ]
518
+ /// ```
519
+ #[ stable( feature = "nonzero_min_max" , since = "1.70.0" ) ]
520
+ pub const MIN : Self = Self :: new( 1 ) . unwrap( ) ;
521
+
522
+ /// The largest value that can be represented by this non-zero
523
+ /// integer type,
524
+ #[ doc = concat!( "equal to [`" , stringify!( $Int) , "::MAX`]." ) ]
525
+ ///
526
+ /// # Examples
527
+ ///
528
+ /// ```
529
+ #[ doc = concat!( "# use std::num::" , stringify!( $Ty) , ";" ) ]
530
+ #[ doc = concat!( "assert_eq!(" , stringify!( $Ty) , "::MAX.get(), " , stringify!( $Int) , "::MAX);" ) ]
531
+ /// ```
532
+ #[ stable( feature = "nonzero_min_max" , since = "1.70.0" ) ]
533
+ pub const MAX : Self = Self :: new( <$Int>:: MAX ) . unwrap( ) ;
534
+
510
535
/// Adds an unsigned integer to a non-zero value.
511
536
/// Checks for overflow and returns [`None`] on overflow.
512
537
/// As a consequence, the result cannot wrap to zero.
@@ -1163,39 +1188,6 @@ macro_rules! sign_dependent_expr {
1163
1188
} ;
1164
1189
}
1165
1190
1166
- macro_rules! nonzero_min_max_unsigned {
1167
- ( $( $Ty: ident( $Int: ident) ; ) + ) => {
1168
- $(
1169
- impl $Ty {
1170
- /// The smallest value that can be represented by this non-zero
1171
- /// integer type, 1.
1172
- ///
1173
- /// # Examples
1174
- ///
1175
- /// ```
1176
- #[ doc = concat!( "# use std::num::" , stringify!( $Ty) , ";" ) ]
1177
- #[ doc = concat!( "assert_eq!(" , stringify!( $Ty) , "::MIN.get(), 1" , stringify!( $Int) , ");" ) ]
1178
- /// ```
1179
- #[ stable( feature = "nonzero_min_max" , since = "1.70.0" ) ]
1180
- pub const MIN : Self = Self :: new( 1 ) . unwrap( ) ;
1181
-
1182
- /// The largest value that can be represented by this non-zero
1183
- /// integer type,
1184
- #[ doc = concat!( "equal to [`" , stringify!( $Int) , "::MAX`]." ) ]
1185
- ///
1186
- /// # Examples
1187
- ///
1188
- /// ```
1189
- #[ doc = concat!( "# use std::num::" , stringify!( $Ty) , ";" ) ]
1190
- #[ doc = concat!( "assert_eq!(" , stringify!( $Ty) , "::MAX.get(), " , stringify!( $Int) , "::MAX);" ) ]
1191
- /// ```
1192
- #[ stable( feature = "nonzero_min_max" , since = "1.70.0" ) ]
1193
- pub const MAX : Self = Self :: new( <$Int>:: MAX ) . unwrap( ) ;
1194
- }
1195
- ) +
1196
- }
1197
- }
1198
-
1199
1191
macro_rules! nonzero_min_max_signed {
1200
1192
( $( $Ty: ident( $Int: ident) ; ) + ) => {
1201
1193
$(
@@ -1238,15 +1230,6 @@ macro_rules! nonzero_min_max_signed {
1238
1230
}
1239
1231
}
1240
1232
1241
- nonzero_min_max_unsigned ! {
1242
- NonZeroU8 ( u8 ) ;
1243
- NonZeroU16 ( u16 ) ;
1244
- NonZeroU32 ( u32 ) ;
1245
- NonZeroU64 ( u64 ) ;
1246
- NonZeroU128 ( u128 ) ;
1247
- NonZeroUsize ( usize ) ;
1248
- }
1249
-
1250
1233
nonzero_min_max_signed ! {
1251
1234
NonZeroI8 ( i8 ) ;
1252
1235
NonZeroI16 ( i16 ) ;
0 commit comments