From 36a3e5e4376b2b007ec81967fb4e0c4bdcbcf36f Mon Sep 17 00:00:00 2001 From: Runji Wang Date: Mon, 17 Jun 2024 16:14:16 +0800 Subject: [PATCH] fix: fix clippy on the latest stable toolchain (#219) Signed-off-by: Runji Wang --- madsim/src/std/net/tcp.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/madsim/src/std/net/tcp.rs b/madsim/src/std/net/tcp.rs index 149764c7..db05f2af 100644 --- a/madsim/src/std/net/tcp.rs +++ b/madsim/src/std/net/tcp.rs @@ -218,7 +218,7 @@ impl Endpoint { trace!("send: {} -> {}, tag={}", self.addr, dst, tag); let sender = self.get_or_connect(dst).await; // Safety: sender task will refer the data until the `done` await return. - let bufs = unsafe { std::mem::transmute(bufs) }; + let bufs = unsafe { std::mem::transmute::<&mut [IoSlice<'_>], &mut [IoSlice<'_>]>(bufs) }; let (done, done_recver) = oneshot::channel(); sender.send(SendMsg { tag, bufs, done }).await.ok().unwrap(); done_recver.await.unwrap(); @@ -320,6 +320,8 @@ fn advance_slices(bufs: &mut &mut [IoSlice<'_>], n: usize) { *bufs = &mut std::mem::take(bufs)[remove..]; if !bufs.is_empty() { // bufs[0].advance(n - accumulated_len) - bufs[0] = IoSlice::new(unsafe { std::mem::transmute(&bufs[0][n - accumulated_len..]) }); + bufs[0] = IoSlice::new(unsafe { + std::mem::transmute::<&[u8], &[u8]>(&bufs[0][n - accumulated_len..]) + }); } }