From 3de0af1a4da54885dd312e5e6f39641f5da06410 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Tue, 5 Dec 2023 18:28:52 -0800 Subject: [PATCH] Move 'impl FromStr for NonZero' into nonzero_integer macro --- library/core/src/num/nonzero.rs | 11 ++--------- 1 file 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::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 ;)+ ) => { $(