Skip to content

Commit

Permalink
fix: fix clippy lint
Browse files Browse the repository at this point in the history
  • Loading branch information
wyfo committed Jul 12, 2024
1 parent 45817aa commit e3c70bd
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 7 deletions.
3 changes: 2 additions & 1 deletion src/loom.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ mod without_loom {
pub(crate) struct LoomUnsafeCell<T>(cell::UnsafeCell<T>);

impl<T> LoomUnsafeCell<T> {
pub(crate) const fn new(data: T) -> Self {
#[cfg(feature = "std")]
pub(crate) fn new(data: T) -> Self {
Self(cell::UnsafeCell::new(data))
}

Expand Down
2 changes: 1 addition & 1 deletion src/synchronized/atomic_waker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 => {
Expand Down
8 changes: 5 additions & 3 deletions src/write_vectored.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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, IoSlice>(IoSlice::new(header))
}))
} else {
start += 1;
Expand All @@ -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, IoSlice>(IoSlice::new(trailer))
}))
} else {
end -= 1;
Expand All @@ -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,
}
Expand Down
2 changes: 1 addition & 1 deletion src/write_vectored/array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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, IoSlice>(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);
Expand Down
2 changes: 1 addition & 1 deletion src/write_vectored/vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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, IoSlice>(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);
Expand Down

0 comments on commit e3c70bd

Please sign in to comment.