about summary refs log tree commit diff
diff options
context:
space:
mode:
authorzlfn <ung@zlfn.space>2024-10-15 18:23:39 +0900
committerzlfn <ung@zlfn.space>2024-10-15 18:23:39 +0900
commit918dc38733985770d1cdcea76169340c620c1f32 (patch)
treeacee080672da73b256ca11f25ef0104ee9c50420
parent88f311479dd19288e5ad85e22cd80368489ce1e9 (diff)
downloadrust-918dc38733985770d1cdcea76169340c620c1f32.tar.gz
rust-918dc38733985770d1cdcea76169340c620c1f32.zip
Combine impl_int and impl_uint
Two macros are exactly the same.
-rw-r--r--library/core/src/fmt/num.rs19
1 files changed, 4 insertions, 15 deletions
diff --git a/library/core/src/fmt/num.rs b/library/core/src/fmt/num.rs
index aecd725eca5..cc94c392de5 100644
--- a/library/core/src/fmt/num.rs
+++ b/library/core/src/fmt/num.rs
@@ -31,22 +31,11 @@ macro_rules! impl_int {
       })*
     )
 }
-macro_rules! impl_uint {
-    ($($t:ident)*) => (
-      $(impl DisplayInt for $t {
-          fn zero() -> Self { 0 }
-          fn from_u8(u: u8) -> Self { u as Self }
-          fn to_u8(&self) -> u8 { *self as u8 }
-          #[cfg(not(any(target_pointer_width = "64", target_arch = "wasm32")))]
-          fn to_u32(&self) -> u32 { *self as u32 }
-          fn to_u64(&self) -> u64 { *self as u64 }
-          fn to_u128(&self) -> u128 { *self as u128 }
-      })*
-    )
-}
 
-impl_int! { i8 i16 i32 i64 i128 isize }
-impl_uint! { u8 u16 u32 u64 u128 usize }
+impl_int! {
+    i8 i16 i32 i64 i128 isize
+    u8 u16 u32 u64 u128 usize
+}
 
 /// A type that represents a specific radix
 ///