Skip to content

Commit 451083c

Browse files
committed
Use ptr.cast<T>() instead of mem::transmute(ptr).
1 parent b5c89a6 commit 451083c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/netbsd.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ pub fn getrandom_inner(dest: &mut [MaybeUninit<u8>]) -> Result<(), Error> {
3131
// getrandom(2) was introduced in NetBSD 10.0
3232
static GETRANDOM: Weak = unsafe { Weak::new("getrandom\0") };
3333
if let Some(fptr) = GETRANDOM.ptr() {
34-
let func: GetRandomFn = unsafe { core::mem::transmute(fptr) };
34+
let func = fptr.cast::<GetRandomFn>().as_ptr();
3535
return sys_fill_exact(dest, |buf| unsafe {
3636
func(buf.as_mut_ptr().cast::<u8>(), buf.len(), 0)
3737
});

0 commit comments

Comments
 (0)