mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-30 14:52:56 +03:00
Rollup merge of #67322 - lzutao:nonzero-use-self, r=joshtriplett
use Self alias in place of macros
This commit is contained in:
@@ -67,7 +67,7 @@ impl $Ty {
|
||||
)]
|
||||
#[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 @@ impl $Ty {
|
||||
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
|
||||
}
|
||||
|
||||
@@ -1263,7 +1263,7 @@ impl $atomic_type {
|
||||
#[$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)}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user