about summary refs log tree commit diff
path: root/library/core/src/ptr
diff options
context:
space:
mode:
authorMarkus Reiter <me@reitermark.us>2024-02-08 23:03:25 +0100
committerMarkus Reiter <me@reitermark.us>2024-02-15 08:09:42 +0100
commita90cc05233858fcd16c3ca0e0b4320fc5ae09af2 (patch)
tree003c31cd913ce7f1acb1bd12aeca0fcde1ccfee6 /library/core/src/ptr
parent746a58d4359786e4aebb372a30829706fa5a968f (diff)
downloadrust-a90cc05233858fcd16c3ca0e0b4320fc5ae09af2.tar.gz
rust-a90cc05233858fcd16c3ca0e0b4320fc5ae09af2.zip
Replace `NonZero::<_>::new` with `NonZero::new`.
Diffstat (limited to 'library/core/src/ptr')
-rw-r--r--library/core/src/ptr/alignment.rs2
-rw-r--r--library/core/src/ptr/non_null.rs2
2 files changed, 2 insertions, 2 deletions
diff --git a/library/core/src/ptr/alignment.rs b/library/core/src/ptr/alignment.rs
index ad22ee5a027..d2422bb80ae 100644
--- a/library/core/src/ptr/alignment.rs
+++ b/library/core/src/ptr/alignment.rs
@@ -100,7 +100,7 @@ impl Alignment {
     #[inline]
     pub const fn as_nonzero(self) -> NonZeroUsize {
         // SAFETY: All the discriminants are non-zero.
-        unsafe { NonZero::<usize>::new_unchecked(self.as_usize()) }
+        unsafe { NonZero::new_unchecked(self.as_usize()) }
     }
 
     /// Returns the base-2 logarithm of the alignment.
diff --git a/library/core/src/ptr/non_null.rs b/library/core/src/ptr/non_null.rs
index 2246596a883..16e90343993 100644
--- a/library/core/src/ptr/non_null.rs
+++ b/library/core/src/ptr/non_null.rs
@@ -295,7 +295,7 @@ impl<T: ?Sized> NonNull<T> {
     pub fn addr(self) -> NonZeroUsize {
         // SAFETY: The pointer is guaranteed by the type to be non-null,
         // meaning that the address will be non-zero.
-        unsafe { NonZero::<usize>::new_unchecked(self.pointer.addr()) }
+        unsafe { NonZero::new_unchecked(self.pointer.addr()) }
     }
 
     /// Creates a new pointer with the given address.