Resolve a huge portion of the clippy lints

This commit is contained in:
Speedy_Lex
2025-10-06 12:30:23 +00:00
committed by Jeremy Soller
parent db8fb14614
commit 0931a7f49f
57 changed files with 451 additions and 509 deletions
+9 -12
View File
@@ -225,13 +225,10 @@ impl<L: Level, T> Mutex<L, T> {
&'a self,
lock_token: LockToken<'a, LP>,
) -> Option<MutexGuard<'a, L, T>> {
match self.inner.try_lock() {
Some(inner) => Some(MutexGuard {
inner,
lock_token: LockToken::downgraded(lock_token),
}),
None => None,
}
self.inner.try_lock().map(|inner| MutexGuard {
inner,
lock_token: LockToken::downgraded(lock_token),
})
}
/// Consumes this Mutex, returning the underlying data.
@@ -356,7 +353,7 @@ pub struct RwLockWriteGuard<'a, L: Level, T> {
lock_token: LockToken<'a, L>,
}
impl<'a, L: Level, T> RwLockWriteGuard<'a, L, T> {
impl<L: Level, T> RwLockWriteGuard<'_, L, T> {
/// Split the guard into two parts, the first a mutable reference to the held content
/// the second a [`LockToken`] that can be used for further locking
pub fn token_split(&mut self) -> (&mut T, LockToken<'_, L>) {
@@ -364,7 +361,7 @@ impl<'a, L: Level, T> RwLockWriteGuard<'a, L, T> {
}
}
impl<'a, L: Level, T> core::ops::Deref for RwLockWriteGuard<'a, L, T> {
impl<L: Level, T> core::ops::Deref for RwLockWriteGuard<'_, L, T> {
type Target = T;
fn deref(&self) -> &Self::Target {
@@ -372,7 +369,7 @@ impl<'a, L: Level, T> core::ops::Deref for RwLockWriteGuard<'a, L, T> {
}
}
impl<'a, L: Level, T> core::ops::DerefMut for RwLockWriteGuard<'a, L, T> {
impl<L: Level, T> core::ops::DerefMut for RwLockWriteGuard<'_, L, T> {
fn deref_mut(&mut self) -> &mut Self::Target {
self.inner.deref_mut()
}
@@ -384,7 +381,7 @@ pub struct RwLockReadGuard<'a, L: Level, T> {
lock_token: LockToken<'a, L>,
}
impl<'a, L: Level, T> RwLockReadGuard<'a, L, T> {
impl<L: Level, T> RwLockReadGuard<'_, L, T> {
/// Split the guard into two parts, the first a reference to the held content
/// the second a [`LockToken`] that can be used for further locking
pub fn token_split(&mut self) -> (&T, LockToken<'_, L>) {
@@ -392,7 +389,7 @@ impl<'a, L: Level, T> RwLockReadGuard<'a, L, T> {
}
}
impl<'a, L: Level, T> core::ops::Deref for RwLockReadGuard<'a, L, T> {
impl<L: Level, T> core::ops::Deref for RwLockReadGuard<'_, L, T> {
type Target = T;
fn deref(&self) -> &Self::Target {
+2 -8
View File
@@ -82,16 +82,10 @@ impl<T> WaitQueue<T> {
let (s1, s2) = inner.as_slices();
let s1_bytes = unsafe {
core::slice::from_raw_parts(
s1.as_ptr().cast::<u8>(),
s1.len() * core::mem::size_of::<T>(),
)
core::slice::from_raw_parts(s1.as_ptr().cast::<u8>(), core::mem::size_of_val(s1))
};
let s2_bytes = unsafe {
core::slice::from_raw_parts(
s2.as_ptr().cast::<u8>(),
s2.len() * core::mem::size_of::<T>(),
)
core::slice::from_raw_parts(s2.as_ptr().cast::<u8>(), core::mem::size_of_val(s2))
};
let mut bytes_copied = buf.copy_common_bytes_from_slice(s1_bytes)?;