Skip to content

Commit

Permalink
Fix beta Clippy warnings
Browse files Browse the repository at this point in the history
clippy 0.1.83 (88c1c3c1102 2024-10-18)
  • Loading branch information
tatsuya6502 committed Nov 3, 2024
1 parent 732ff1f commit df953f2
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/common/deque.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ impl<T> Drop for Deque<T> {
fn drop(&mut self) {
struct DropGuard<'a, T>(&'a mut Deque<T>);

impl<'a, T> Drop for DropGuard<'a, T> {
impl<T> Drop for DropGuard<'_, T> {
fn drop(&mut self) {
// Continue the same loop we do below. This only runs when a destructor has
// panicked. If another one panics this will abort.
Expand Down
8 changes: 8 additions & 0 deletions src/sync/base_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,10 @@ where
}
}

// Clippy beta 0.1.83 (f41c7ed9889 2024-10-31) warns about unused lifetimes on 'a.
// This seems a false positive. The lifetimes are used in the trait bounds.
// https://rust-lang.github.io/rust-clippy/master/index.html#extra_unused_lifetimes
#[allow(clippy::extra_unused_lifetimes)]
impl<'a, K, V, S> BaseCache<K, V, S>
where
K: 'a + Eq + Hash,
Expand Down Expand Up @@ -620,6 +624,10 @@ impl<K, V, S> Inner<K, V, S> {
}
}

// Clippy beta 0.1.83 (f41c7ed9889 2024-10-31) warns about unused lifetimes on 'a.
// This seems a false positive. The lifetimes are used in the trait bounds.
// https://rust-lang.github.io/rust-clippy/master/index.html#extra_unused_lifetimes
#[allow(clippy::extra_unused_lifetimes)]
impl<'a, K, V, S> Inner<K, V, S>
where
K: 'a + Eq + Hash,
Expand Down
4 changes: 4 additions & 0 deletions src/sync/cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,10 @@ where
}
}

// Clippy beta 0.1.83 (f41c7ed9889 2024-10-31) warns about unused lifetimes on 'a.
// This seems a false positive. The lifetimes are used in the trait bounds.
// https://rust-lang.github.io/rust-clippy/master/index.html#extra_unused_lifetimes
#[allow(clippy::extra_unused_lifetimes)]
impl<'a, K, V, S> Cache<K, V, S>
where
K: 'a + Eq + Hash,
Expand Down
12 changes: 10 additions & 2 deletions src/sync/iter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,23 @@ where
}
}

unsafe impl<'a, 'i, K, V, S> Send for Iter<'i, K, V, S>
// Clippy beta 0.1.83 (f41c7ed9889 2024-10-31) warns about unused lifetimes on 'a.
// This seems a false positive. The lifetimes are used in the trait bounds.
// https://rust-lang.github.io/rust-clippy/master/index.html#extra_unused_lifetimes
#[allow(clippy::extra_unused_lifetimes)]
unsafe impl<'a, K, V, S> Send for Iter<'_, K, V, S>
where
K: 'a + Eq + Hash + Send,
V: 'a + Send,
S: 'a + BuildHasher + Clone,
{
}

unsafe impl<'a, 'i, K, V, S> Sync for Iter<'i, K, V, S>
// Clippy beta 0.1.83 (f41c7ed9889 2024-10-31) warns about unused lifetimes on 'a.
// This seems a false positive. The lifetimes are used in the trait bounds.
// https://rust-lang.github.io/rust-clippy/master/index.html#extra_unused_lifetimes
#[allow(clippy::extra_unused_lifetimes)]
unsafe impl<'a, K, V, S> Sync for Iter<'_, K, V, S>
where
K: 'a + Eq + Hash + Sync,
V: 'a + Sync,
Expand Down
4 changes: 2 additions & 2 deletions src/sync/mapref.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ type DashMapRef<'a, K, V> =

pub struct EntryRef<'a, K, V>(DashMapRef<'a, K, V>);

unsafe impl<'a, K, V> Sync for EntryRef<'a, K, V>
unsafe impl<K, V> Sync for EntryRef<'_, K, V>
where
K: Eq + Hash + Send + Sync,
V: Send + Sync,
Expand Down Expand Up @@ -36,7 +36,7 @@ where
}
}

impl<'a, K, V> std::ops::Deref for EntryRef<'a, K, V>
impl<K, V> std::ops::Deref for EntryRef<'_, K, V>
where
K: Eq + Hash,
{
Expand Down
3 changes: 2 additions & 1 deletion src/unsync/cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,8 @@ where
/// Like the `invalidate` method, this method does not clear the historic
/// popularity estimator of keys so that it retains the client activities of
/// trying to retrieve an item.

// -----------------------------------------------------------------------
// (The followings are not doc comments)
// We need this #[allow(...)] to avoid a false Clippy warning about needless
// collect to create keys_to_invalidate.
// clippy 0.1.52 (9a1dfd2dc5c 2021-04-30) in Rust 1.52.0-beta.7
Expand Down

0 comments on commit df953f2

Please sign in to comment.