From: Oliver Scherer Date: Mon, 19 Nov 2018 13:45:40 +0000 (+0100) Subject: Increase code-reuse and -readability X-Git-Url: https://git.lizzy.rs/?a=commitdiff_plain;h=3ce211dbd0f55f79212fcde773a2060ccfec031d;p=rust.git Increase code-reuse and -readability --- 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 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 }