diff options
| author | Mazdak Farrokhzad <twingoow@gmail.com> | 2019-12-16 17:33:10 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-12-16 17:33:10 +0100 |
| commit | 5609683fabfca0cd112c1b5ffebcefa7a31389fc (patch) | |
| tree | dcc5490f12a0c3f171ae8c71fa6a6a8166f9c512 /src | |
| parent | f05646ec191d6fe30feacf96a8ff3ceaa43f321c (diff) | |
| parent | 7bf55f4aa536ce8fe12fabe640ea4eb5c5a7a572 (diff) | |
| download | rust-5609683fabfca0cd112c1b5ffebcefa7a31389fc.tar.gz rust-5609683fabfca0cd112c1b5ffebcefa7a31389fc.zip | |
Rollup merge of #67322 - lzutao:nonzero-use-self, r=joshtriplett
use Self alias in place of macros
Diffstat (limited to 'src')
| -rw-r--r-- | src/libcore/num/mod.rs | 4 | ||||
| -rw-r--r-- | 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 33715418ffd..d091a8d86ea 100644 --- a/src/libcore/num/mod.rs +++ b/src/libcore/num/mod.rs @@ -67,7 +67,7 @@ assert_eq!(size_of::<Option<core::num::", stringify!($Ty), ">>(), 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::<Option<core::num::", stringify!($Ty), ">>(), size_of::<", s pub fn new(n: $Int) -> Option<Self> { 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 7756335ee20..d5b0bc42038 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)} } } |
