Skip to content

Commit

Permalink
Rollup merge of rust-lang#67322 - lzutao:nonzero-use-self, r=joshtrip…
Browse files Browse the repository at this point in the history
…lett

use Self alias in place of macros
  • Loading branch information
Centril committed Dec 16, 2019
2 parents f05646e + 7bf55f4 commit 5609683
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/libcore/num/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion src/libcore/sync/atomic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)}
}
}

Expand Down

0 comments on commit 5609683

Please sign in to comment.