Skip to content

Commit

Permalink
Use ptr.cast<T>() instead of mem::transmute(ptr).
Browse files Browse the repository at this point in the history
  • Loading branch information
briansmith committed May 21, 2024
1 parent b5c89a6 commit 451083c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/netbsd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ pub fn getrandom_inner(dest: &mut [MaybeUninit<u8>]) -> Result<(), Error> {
// getrandom(2) was introduced in NetBSD 10.0
static GETRANDOM: Weak = unsafe { Weak::new("getrandom\0") };
if let Some(fptr) = GETRANDOM.ptr() {
let func: GetRandomFn = unsafe { core::mem::transmute(fptr) };
let func = fptr.cast::<GetRandomFn>().as_ptr();
return sys_fill_exact(dest, |buf| unsafe {
func(buf.as_mut_ptr().cast::<u8>(), buf.len(), 0)
});
Expand Down

0 comments on commit 451083c

Please sign in to comment.