From 7bf55f4aa536ce8fe12fabe640ea4eb5c5a7a572 Mon Sep 17 00:00:00 2001 From: Lzu Tao Date: Sun, 15 Dec 2019 06:07:46 +0000 Subject: [PATCH] use Self alias in place of macros --- src/libcore/num/mod.rs | 4 ++-- src/libcore/sync/atomic.rs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/libcore/num/mod.rs b/src/libcore/num/mod.rs index 33715418ffd73..d091a8d86ea49 100644 --- a/src/libcore/num/mod.rs +++ b/src/libcore/num/mod.rs @@ -67,7 +67,7 @@ assert_eq!(size_of::>(), size_of::<", s )] #[inline] pub const unsafe fn new_unchecked(n: $Int) -> Self { - $Ty(n) + Self(n) } /// Creates a non-zero if the given value is not zero. @@ -76,7 +76,7 @@ assert_eq!(size_of::>(), size_of::<", s pub fn new(n: $Int) -> Option { if n != 0 { // SAFETY: we just checked that there's no `0` - Some(unsafe { $Ty(n) }) + Some(unsafe { Self(n) }) } else { None } diff --git a/src/libcore/sync/atomic.rs b/src/libcore/sync/atomic.rs index 7756335ee207d..d5b0bc420382f 100644 --- a/src/libcore/sync/atomic.rs +++ b/src/libcore/sync/atomic.rs @@ -1263,7 +1263,7 @@ let atomic_forty_two = ", stringify!($atomic_type), "::new(42); #[$stable] #[cfg_attr(not(bootstrap), $const_stable)] pub const fn new(v: $int_type) -> Self { - $atomic_type {v: UnsafeCell::new(v)} + Self {v: UnsafeCell::new(v)} } }