Skip to content

Commit 528d04c

Browse files
committed
use NonNull::cast instead of as where possible
1 parent 28d018a commit 528d04c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -830,7 +830,7 @@ impl<T, const N: usize> SmallVec<T, N> {
830830
// so the copy is within bounds of the inline member
831831
copy_nonoverlapping(ptr.as_ptr(), self.raw.as_mut_ptr_inline(), len);
832832
drop(DropDealloc {
833-
ptr: NonNull::new_unchecked(ptr.as_ptr() as *mut u8),
833+
ptr: NonNull::new_unchecked(ptr.cast().as_ptr()),
834834
size_bytes: old_cap * size_of::<T>(),
835835
align: align_of::<T>(),
836836
});
@@ -909,7 +909,7 @@ impl<T, const N: usize> SmallVec<T, N> {
909909
copy_nonoverlapping(ptr.as_ptr(), self.raw.as_mut_ptr_inline(), len);
910910
self.set_inline();
911911
alloc::alloc::dealloc(
912-
ptr.as_ptr() as *mut u8,
912+
ptr.cast().as_ptr(),
913913
Layout::from_size_align_unchecked(capacity * size_of::<T>(), align_of::<T>()),
914914
);
915915
}

0 commit comments

Comments
 (0)