From 85dd2106bdc3476c0eb73c97f2f4b338a3486749 Mon Sep 17 00:00:00 2001 From: Botahamec Date: Fri, 20 Dec 2024 18:28:08 -0500 Subject: Fix clippy issues --- src/collection/guard.rs | 12 ++++++------ src/collection/ref.rs | 20 +++++++++++++------- 2 files changed, 19 insertions(+), 13 deletions(-) (limited to 'src/collection') diff --git a/src/collection/guard.rs b/src/collection/guard.rs index 0b8a583..70bb3a6 100644 --- a/src/collection/guard.rs +++ b/src/collection/guard.rs @@ -5,19 +5,19 @@ use crate::key::Keyable; use super::LockGuard; -impl<'key, Guard: Debug, Key: Keyable> Debug for LockGuard<'key, Guard, Key> { +impl Debug for LockGuard<'_, Guard, Key> { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { Debug::fmt(&**self, f) } } -impl<'key, Guard: Display, Key: Keyable> Display for LockGuard<'key, Guard, Key> { +impl Display for LockGuard<'_, Guard, Key> { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { Display::fmt(&**self, f) } } -impl<'key, Guard, Key: Keyable> Deref for LockGuard<'key, Guard, Key> { +impl Deref for LockGuard<'_, Guard, Key> { type Target = Guard; fn deref(&self) -> &Self::Target { @@ -25,19 +25,19 @@ impl<'key, Guard, Key: Keyable> Deref for LockGuard<'key, Guard, Key> { } } -impl<'key, Guard, Key: Keyable> DerefMut for LockGuard<'key, Guard, Key> { +impl DerefMut for LockGuard<'_, Guard, Key> { fn deref_mut(&mut self) -> &mut Self::Target { &mut self.guard } } -impl<'key, Guard, Key: Keyable> AsRef for LockGuard<'key, Guard, Key> { +impl AsRef for LockGuard<'_, Guard, Key> { fn as_ref(&self) -> &Guard { &self.guard } } -impl<'key, Guard, Key: Keyable> AsMut for LockGuard<'key, Guard, Key> { +impl AsMut for LockGuard<'_, Guard, Key> { fn as_mut(&mut self) -> &mut Guard { &mut self.guard } diff --git a/src/collection/ref.rs b/src/collection/ref.rs index 60abdfa..7c0d40a 100644 --- a/src/collection/ref.rs +++ b/src/collection/ref.rs @@ -26,7 +26,7 @@ fn contains_duplicates(l: &[&dyn RawLock]) -> bool { .any(|window| std::ptr::eq(window[0], window[1])) } -impl<'a, L> AsRef for RefLockCollection<'a, L> { +impl AsRef for RefLockCollection<'_, L> { fn as_ref(&self) -> &L { self.data } @@ -44,7 +44,7 @@ where } } -unsafe impl<'a, L: Lockable + Send + Sync> RawLock for RefLockCollection<'a, L> { +unsafe impl RawLock for RefLockCollection<'_, L> { unsafe fn lock(&self) { for lock in &self.locks { lock.lock(); @@ -78,10 +78,16 @@ unsafe impl<'a, L: Lockable + Send + Sync> RawLock for RefLockCollection<'a, L> } } -unsafe impl<'c, L: Lockable> Lockable for RefLockCollection<'c, L> { - type Guard<'g> = L::Guard<'g> where Self: 'g; +unsafe impl Lockable for RefLockCollection<'_, L> { + type Guard<'g> + = L::Guard<'g> + where + Self: 'g; - type ReadGuard<'g> = L::ReadGuard<'g> where Self: 'g; + type ReadGuard<'g> + = L::ReadGuard<'g> + where + Self: 'g; fn get_ptrs<'a>(&'a self, ptrs: &mut Vec<&'a dyn RawLock>) { ptrs.extend_from_slice(&self.locks); @@ -96,9 +102,9 @@ unsafe impl<'c, L: Lockable> Lockable for RefLockCollection<'c, L> { } } -unsafe impl<'c, L: Sharable> Sharable for RefLockCollection<'c, L> {} +unsafe impl Sharable for RefLockCollection<'_, L> {} -impl<'a, L: Debug> Debug for RefLockCollection<'a, L> { +impl Debug for RefLockCollection<'_, L> { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { f.debug_struct(stringify!(RefLockCollection)) .field("data", self.data) -- cgit v1.2.3