From 3ce211dbd0f55f79212fcde773a2060ccfec031d Mon Sep 17 00:00:00 2001 From: Oliver Scherer Date: Mon, 19 Nov 2018 14:45:40 +0100 Subject: [PATCH] Increase code-reuse and -readability --- src/libcore/ptr.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libcore/ptr.rs b/src/libcore/ptr.rs index a07c7260f712..0387708033b5 100644 --- a/src/libcore/ptr.rs +++ b/src/libcore/ptr.rs @@ -2903,7 +2903,7 @@ impl NonNull { #[inline] pub fn new(ptr: *mut T) -> Option { if !ptr.is_null() { - Some(NonNull { pointer: unsafe { NonZero(ptr as _) } }) + Some(unsafe { Self::new_unchecked(ptr) }) } else { None }