Skip to content

Commit 9717c5b

Browse files
committed
use NonNull::cast instead of as where possible
1 parent f090131 commit 9717c5b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1080,7 +1080,7 @@ impl<T, const N: usize> SmallVec<T, N> {
10801080
// so the copy is within bounds of the inline member
10811081
copy_nonoverlapping(ptr.as_ptr(), self.raw.as_mut_ptr_inline(), len);
10821082
drop(DropDealloc {
1083-
ptr: NonNull::new_unchecked(ptr.as_ptr() as *mut u8),
1083+
ptr: NonNull::new_unchecked(ptr.cast().as_ptr()),
10841084
size_bytes: old_cap * size_of::<T>(),
10851085
align: align_of::<T>(),
10861086
});
@@ -1159,7 +1159,7 @@ impl<T, const N: usize> SmallVec<T, N> {
11591159
copy_nonoverlapping(ptr.as_ptr(), self.raw.as_mut_ptr_inline(), len);
11601160
self.set_inline();
11611161
alloc::alloc::dealloc(
1162-
ptr.as_ptr() as *mut u8,
1162+
ptr.cast().as_ptr(),
11631163
Layout::from_size_align_unchecked(capacity * size_of::<T>(), align_of::<T>()),
11641164
);
11651165
}

0 commit comments

Comments
 (0)