From ac0bb67e8b3b3a48572f44968a2a761e8c4d3997 Mon Sep 17 00:00:00 2001 From: sn-anssi Date: Mon, 8 Jul 2024 11:50:13 +0200 Subject: [PATCH] Clippy: Add type annotations for mem::transmute --- src/udp.rs | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/udp.rs b/src/udp.rs index 848d618..e3bd37a 100644 --- a/src/udp.rs +++ b/src/udp.rs @@ -54,7 +54,12 @@ impl UdpMessages { sin_port: addr4.port().to_be(), ..unsafe { mem::zeroed() } }); - unsafe { mem::transmute(sockaddr_in) } + unsafe { + mem::transmute::< + std::boxed::Box, + std::boxed::Box, + >(sockaddr_in) + } } net::SocketAddr::V6(addr6) => { let sockaddr_in6 = Box::new(libc::sockaddr_in6 { @@ -66,7 +71,12 @@ impl UdpMessages { }, sin6_scope_id: addr6.scope_id(), }); - unsafe { mem::transmute(sockaddr_in6) } + unsafe { + mem::transmute::< + std::boxed::Box, + std::boxed::Box, + >(sockaddr_in6) + } } }); @@ -169,7 +179,7 @@ impl UdpMessages { thread::sleep(sleep_duration); } - }else { + } else { let to_send = bufchunk.len(); for (i, buf) in bufchunk.iter_mut().enumerate() { @@ -177,7 +187,7 @@ impl UdpMessages { self.iovecs[i].iov_base = buf.as_mut_ptr().cast::(); self.iovecs[i].iov_len = buf.len(); } - + let nb_msg; unsafe { nb_msg = libc::sendmmsg(