@@ -124,7 +124,7 @@ impl<T: Sized> NonNull<T> {
124
124
#[must_use]
125
125
#[unstable(feature = "ptr_as_uninit", issue = "75402")]
126
126
#[rustc_const_unstable(feature = "const_ptr_as_ref", issue = "91822")]
127
- pub const unsafe fn as_uninit_ref<'a>(& self) -> &'a MaybeUninit<T> {
127
+ pub const unsafe fn as_uninit_ref<'a>(self) -> &'a MaybeUninit<T> {
128
128
// SAFETY: the caller must guarantee that `self` meets all the
129
129
// requirements for a reference.
130
130
unsafe { &*self.cast().as_ptr() }
@@ -158,7 +158,7 @@ impl<T: Sized> NonNull<T> {
158
158
#[must_use]
159
159
#[unstable(feature = "ptr_as_uninit", issue = "75402")]
160
160
#[rustc_const_unstable(feature = "const_ptr_as_ref", issue = "91822")]
161
- pub const unsafe fn as_uninit_mut<'a>(&mut self) -> &'a mut MaybeUninit<T> {
161
+ pub const unsafe fn as_uninit_mut<'a>(self) -> &'a mut MaybeUninit<T> {
162
162
// SAFETY: the caller must guarantee that `self` meets all the
163
163
// requirements for a reference.
164
164
unsafe { &mut *self.cast().as_ptr() }
@@ -592,7 +592,7 @@ impl<T> NonNull<[T]> {
592
592
#[must_use]
593
593
#[unstable(feature = "ptr_as_uninit", issue = "75402")]
594
594
#[rustc_const_unstable(feature = "const_ptr_as_ref", issue = "91822")]
595
- pub const unsafe fn as_uninit_slice<'a>(& self) -> &'a [MaybeUninit<T>] {
595
+ pub const unsafe fn as_uninit_slice<'a>(self) -> &'a [MaybeUninit<T>] {
596
596
// SAFETY: the caller must uphold the safety contract for `as_uninit_slice`.
597
597
unsafe { slice::from_raw_parts(self.cast().as_ptr(), self.len()) }
598
598
}
@@ -655,7 +655,7 @@ impl<T> NonNull<[T]> {
655
655
#[must_use]
656
656
#[unstable(feature = "ptr_as_uninit", issue = "75402")]
657
657
#[rustc_const_unstable(feature = "const_ptr_as_ref", issue = "91822")]
658
- pub const unsafe fn as_uninit_slice_mut<'a>(& self) -> &'a mut [MaybeUninit<T>] {
658
+ pub const unsafe fn as_uninit_slice_mut<'a>(self) -> &'a mut [MaybeUninit<T>] {
659
659
// SAFETY: the caller must uphold the safety contract for `as_uninit_slice_mut`.
660
660
unsafe { slice::from_raw_parts_mut(self.cast().as_ptr(), self.len()) }
661
661
}
0 commit comments