diff options
| author | David Tolnay <dtolnay@gmail.com> | 2023-12-05 18:28:52 -0800 |
|---|---|---|
| committer | David Tolnay <dtolnay@gmail.com> | 2024-01-14 12:43:49 -0800 |
| commit | 3de0af1a4da54885dd312e5e6f39641f5da06410 (patch) | |
| tree | bc3620736aa74642a3207124e8988b20e216329d | |
| parent | a6152cdd9a6c287411212209a18904ca5d68d484 (diff) | |
| download | rust-3de0af1a4da54885dd312e5e6f39641f5da06410.tar.gz rust-3de0af1a4da54885dd312e5e6f39641f5da06410.zip | |
Move 'impl FromStr for NonZero' into nonzero_integer macro
| -rw-r--r-- | library/core/src/num/nonzero.rs | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/library/core/src/num/nonzero.rs b/library/core/src/num/nonzero.rs index f6ccefa2614..0f5d421235e 100644 --- a/library/core/src/num/nonzero.rs +++ b/library/core/src/num/nonzero.rs @@ -190,13 +190,9 @@ macro_rules! nonzero_integer { #[stable(feature = $feature, since = $since)] (Debug, Display, Binary, Octal, LowerHex, UpperHex) for $Ty } - }; -} -macro_rules! from_str_radix_nzint_impl { - ($($t:ty)*) => {$( #[stable(feature = "nonzero_parse", since = "1.35.0")] - impl FromStr for $t { + impl FromStr for $Ty { type Err = ParseIntError; fn from_str(src: &str) -> Result<Self, Self::Err> { Self::new(from_str_radix(src, 10)?) @@ -205,12 +201,9 @@ macro_rules! from_str_radix_nzint_impl { }) } } - )*} + }; } -from_str_radix_nzint_impl! { NonZeroU8 NonZeroU16 NonZeroU32 NonZeroU64 NonZeroU128 NonZeroUsize -NonZeroI8 NonZeroI16 NonZeroI32 NonZeroI64 NonZeroI128 NonZeroIsize } - macro_rules! nonzero_leading_trailing_zeros { ( $( $Ty: ident($Uint: ty) , $LeadingTestExpr:expr ;)+ ) => { $( |
