From e3c70bde46fccddfa132723eb12cffeed80ce535 Mon Sep 17 00:00:00 2001 From: Joseph Perez Date: Fri, 12 Jul 2024 08:25:05 +0200 Subject: [PATCH] fix: fix clippy lint --- src/loom.rs | 3 ++- src/synchronized/atomic_waker.rs | 2 +- src/write_vectored.rs | 8 +++++--- src/write_vectored/array.rs | 2 +- src/write_vectored/vec.rs | 2 +- 5 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/loom.rs b/src/loom.rs index 36c045e..4c40273 100644 --- a/src/loom.rs +++ b/src/loom.rs @@ -13,7 +13,8 @@ mod without_loom { pub(crate) struct LoomUnsafeCell(cell::UnsafeCell); impl LoomUnsafeCell { - pub(crate) const fn new(data: T) -> Self { + #[cfg(feature = "std")] + pub(crate) fn new(data: T) -> Self { Self(cell::UnsafeCell::new(data)) } diff --git a/src/synchronized/atomic_waker.rs b/src/synchronized/atomic_waker.rs index 8ca7609..01407ba 100644 --- a/src/synchronized/atomic_waker.rs +++ b/src/synchronized/atomic_waker.rs @@ -82,7 +82,7 @@ impl AtomicWaker { let waker = unsafe { self.waker.with_mut(|w| (*w).take()) }; self.state.fetch_and(!WAKING, Ordering::Release); if let Some(waker) = waker { - waker.wake() + waker.wake(); } } state => { diff --git a/src/write_vectored.rs b/src/write_vectored.rs index 4e20e3e..9d2d42a 100644 --- a/src/write_vectored.rs +++ b/src/write_vectored.rs @@ -134,7 +134,7 @@ impl<'a> VectoredSlice<'a> { let header = if let Some(header) = header { // SAFETY: `self.slices[start..end]` will be transmuted right after to `[IoSlice<'a>] Some(mem::replace(&mut self.slices[start], unsafe { - mem::transmute(IoSlice::new(header)) + mem::transmute::(IoSlice::new(header)) })) } else { start += 1; @@ -143,7 +143,7 @@ impl<'a> VectoredSlice<'a> { let trailer = if let Some(trailer) = trailer { // SAFETY: `self.slices[start..end]` will be transmuted right after to `[IoSlice<'a>] Some(mem::replace(&mut self.slices[end - 1], unsafe { - mem::transmute(IoSlice::new(trailer)) + mem::transmute::(IoSlice::new(trailer)) })) } else { end -= 1; @@ -155,7 +155,9 @@ impl<'a> VectoredSlice<'a> { // (respectively `end == self.slices.len()`) means that `self.slices[start]` // (respectively `self.slices[end]`) has `'a` lifetime because it's set from `header` // (respectively `trailer`) parameter above - slices: unsafe { mem::transmute(&mut self.slices[start..end]) }, + slices: unsafe { + mem::transmute::<&mut [IoSlice], &mut [IoSlice]>(&mut self.slices[start..end]) + }, header, trailer, } diff --git a/src/write_vectored/array.rs b/src/write_vectored/array.rs index 6f052ef..b718211 100644 --- a/src/write_vectored/array.rs +++ b/src/write_vectored/array.rs @@ -71,7 +71,7 @@ where unsafe fn insert(&self, index: usize, value: T) { // SAFETY: slice is never read with static lifetime, it will only be used as a reference // with the same lifetime than the slice owner - let slice = unsafe { mem::transmute(IoSlice::new(value.as_ref())) }; + let slice = unsafe { mem::transmute::(IoSlice::new(value.as_ref())) }; self.slices[index + 1].set(slice); self.owned[index].set(MaybeUninit::new(value)); self.total_size.fetch_add(slice.len(), Ordering::AcqRel); diff --git a/src/write_vectored/vec.rs b/src/write_vectored/vec.rs index defd4e4..54a2b7f 100644 --- a/src/write_vectored/vec.rs +++ b/src/write_vectored/vec.rs @@ -68,7 +68,7 @@ where unsafe fn insert(&self, index: usize, value: T) { // SAFETY: slice is never read with static lifetime, it will only be used as a reference // with the same lifetime than the slice owner - let slice = unsafe { mem::transmute(IoSlice::new(value.as_ref())) }; + let slice = unsafe { mem::transmute::(IoSlice::new(value.as_ref())) }; self.slices[index + 1].set(slice); self.owned[index].set(MaybeUninit::new(value)); self.total_size.fetch_add(slice.len(), Ordering::AcqRel);