Skip to content

Commit 3de0af1

Browse files
committed
Move 'impl FromStr for NonZero' into nonzero_integer macro
1 parent a6152cd commit 3de0af1

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

library/core/src/num/nonzero.rs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -190,13 +190,9 @@ macro_rules! nonzero_integer {
190190
#[stable(feature = $feature, since = $since)]
191191
(Debug, Display, Binary, Octal, LowerHex, UpperHex) for $Ty
192192
}
193-
};
194-
}
195193

196-
macro_rules! from_str_radix_nzint_impl {
197-
($($t:ty)*) => {$(
198194
#[stable(feature = "nonzero_parse", since = "1.35.0")]
199-
impl FromStr for $t {
195+
impl FromStr for $Ty {
200196
type Err = ParseIntError;
201197
fn from_str(src: &str) -> Result<Self, Self::Err> {
202198
Self::new(from_str_radix(src, 10)?)
@@ -205,12 +201,9 @@ macro_rules! from_str_radix_nzint_impl {
205201
})
206202
}
207203
}
208-
)*}
204+
};
209205
}
210206

211-
from_str_radix_nzint_impl! { NonZeroU8 NonZeroU16 NonZeroU32 NonZeroU64 NonZeroU128 NonZeroUsize
212-
NonZeroI8 NonZeroI16 NonZeroI32 NonZeroI64 NonZeroI128 NonZeroIsize }
213-
214207
macro_rules! nonzero_leading_trailing_zeros {
215208
( $( $Ty: ident($Uint: ty) , $LeadingTestExpr:expr ;)+ ) => {
216209
$(

0 commit comments

Comments
 (0)