Small fixme in core now that NonZero is generic

This commit is contained in:
Pavel Grigorenko
2024-06-24 17:42:08 +03:00
parent 06c072f158
commit 84474a25a4
2 changed files with 2 additions and 13 deletions

View File

@@ -483,7 +483,6 @@ impl u8 {
Self = u8, Self = u8,
ActualT = u8, ActualT = u8,
SignedT = i8, SignedT = i8,
NonZeroT = NonZero<u8>,
BITS = 8, BITS = 8,
MAX = 255, MAX = 255,
rot = 2, rot = 2,
@@ -1098,7 +1097,6 @@ impl u16 {
Self = u16, Self = u16,
ActualT = u16, ActualT = u16,
SignedT = i16, SignedT = i16,
NonZeroT = NonZero<u16>,
BITS = 16, BITS = 16,
MAX = 65535, MAX = 65535,
rot = 4, rot = 4,
@@ -1147,7 +1145,6 @@ impl u32 {
Self = u32, Self = u32,
ActualT = u32, ActualT = u32,
SignedT = i32, SignedT = i32,
NonZeroT = NonZero<u32>,
BITS = 32, BITS = 32,
MAX = 4294967295, MAX = 4294967295,
rot = 8, rot = 8,
@@ -1171,7 +1168,6 @@ impl u64 {
Self = u64, Self = u64,
ActualT = u64, ActualT = u64,
SignedT = i64, SignedT = i64,
NonZeroT = NonZero<u64>,
BITS = 64, BITS = 64,
MAX = 18446744073709551615, MAX = 18446744073709551615,
rot = 12, rot = 12,
@@ -1195,7 +1191,6 @@ impl u128 {
Self = u128, Self = u128,
ActualT = u128, ActualT = u128,
SignedT = i128, SignedT = i128,
NonZeroT = NonZero<u128>,
BITS = 128, BITS = 128,
MAX = 340282366920938463463374607431768211455, MAX = 340282366920938463463374607431768211455,
rot = 16, rot = 16,
@@ -1221,7 +1216,6 @@ impl usize {
Self = usize, Self = usize,
ActualT = u16, ActualT = u16,
SignedT = isize, SignedT = isize,
NonZeroT = NonZero<usize>,
BITS = 16, BITS = 16,
MAX = 65535, MAX = 65535,
rot = 4, rot = 4,
@@ -1246,7 +1240,6 @@ impl usize {
Self = usize, Self = usize,
ActualT = u32, ActualT = u32,
SignedT = isize, SignedT = isize,
NonZeroT = NonZero<usize>,
BITS = 32, BITS = 32,
MAX = 4294967295, MAX = 4294967295,
rot = 8, rot = 8,
@@ -1271,7 +1264,6 @@ impl usize {
Self = usize, Self = usize,
ActualT = u64, ActualT = u64,
SignedT = isize, SignedT = isize,
NonZeroT = NonZero<usize>,
BITS = 64, BITS = 64,
MAX = 18446744073709551615, MAX = 18446744073709551615,
rot = 12, rot = 12,

View File

@@ -3,7 +3,6 @@ macro_rules! uint_impl {
Self = $SelfT:ty, Self = $SelfT:ty,
ActualT = $ActualT:ident, ActualT = $ActualT:ident,
SignedT = $SignedT:ident, SignedT = $SignedT:ident,
NonZeroT = $NonZeroT:ty,
// There are all for use *only* in doc comments. // There are all for use *only* in doc comments.
// As such, they're all passed as literals -- passing them as a string // As such, they're all passed as literals -- passing them as a string
@@ -1216,8 +1215,7 @@ macro_rules! uint_impl {
without modifying the original"] without modifying the original"]
#[inline] #[inline]
pub const fn checked_ilog2(self) -> Option<u32> { pub const fn checked_ilog2(self) -> Option<u32> {
// FIXME: Simply use `NonZero::new` once it is actually generic. if let Some(x) = NonZero::new(self) {
if let Some(x) = <$NonZeroT>::new(self) {
Some(x.ilog2()) Some(x.ilog2())
} else { } else {
None None
@@ -1239,8 +1237,7 @@ macro_rules! uint_impl {
without modifying the original"] without modifying the original"]
#[inline] #[inline]
pub const fn checked_ilog10(self) -> Option<u32> { pub const fn checked_ilog10(self) -> Option<u32> {
// FIXME: Simply use `NonZero::new` once it is actually generic. if let Some(x) = NonZero::new(self) {
if let Some(x) = <$NonZeroT>::new(self) {
Some(x.ilog10()) Some(x.ilog10())
} else { } else {
None None