about summary refs log tree commit diff
path: root/src/libcore/ptr.rs
diff options
context:
space:
mode:
authorOliver Scherer <github35764891676564198441@oli-obk.de>2018-11-19 14:45:40 +0100
committerOliver Scherer <github35764891676564198441@oli-obk.de>2018-12-04 10:17:37 +0100
commit3ce211dbd0f55f79212fcde773a2060ccfec031d (patch)
treedea6313bf1f9e58acec6b345f20e00533cc30c0b /src/libcore/ptr.rs
parent37ef5e43af477d0cb04f70e9d868361b40cd7a08 (diff)
downloadrust-3ce211dbd0f55f79212fcde773a2060ccfec031d.tar.gz
rust-3ce211dbd0f55f79212fcde773a2060ccfec031d.zip
Increase code-reuse and -readability
Diffstat (limited to 'src/libcore/ptr.rs')
-rw-r--r--src/libcore/ptr.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/libcore/ptr.rs b/src/libcore/ptr.rs
index a07c7260f71..0387708033b 100644
--- a/src/libcore/ptr.rs
+++ b/src/libcore/ptr.rs
@@ -2903,7 +2903,7 @@ impl<T: ?Sized> NonNull<T> {
     #[inline]
     pub fn new(ptr: *mut T) -> Option<Self> {
         if !ptr.is_null() {
-            Some(NonNull { pointer: unsafe { NonZero(ptr as _) } })
+            Some(unsafe { Self::new_unchecked(ptr) })
         } else {
             None
         }