Increase code-reuse and -readability
This commit is contained in:
parent
37ef5e43af
commit
3ce211dbd0
1 changed files with 1 additions and 1 deletions
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue