Skip to content

Commit

Permalink
Fix Clippy warnings
Browse files Browse the repository at this point in the history
clippy 0.1.78 (4147533e05e 2024-03-27)
  • Loading branch information
tatsuya6502 committed Apr 10, 2024
1 parent ae33f8d commit a0f81f7
Show file tree
Hide file tree
Showing 6 changed files with 2 additions and 6 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,6 @@ in `u32`, and the cache will evict entries when the total weighted size exceeds
`max_capacity`.

```rust
use std::convert::TryInto;
use moka::sync::Cache;

fn main() {
Expand Down
2 changes: 2 additions & 0 deletions examples/reinsert_expired_entries_sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,15 @@ fn main() {
// We are going to solve this by making the Sender globally accessible via the
// static OnceLock, and make the eviction listener to clone it per thread.
static SND: OnceLock<Mutex<Sender<Command>>> = OnceLock::new();
#[allow(clippy::incompatible_msrv)] // `set` is stable since 1.70.0.
SND.set(Mutex::new(snd.clone())).unwrap();

// Create the eviction listener.
let listener = move |key: Arc<String>, value: u32, cause: RemovalCause| {
// Keep a clone of the Sender in our thread-local variable, so that we can
// send a command without locking the Mutex every time.
thread_local! {
#[allow(clippy::incompatible_msrv)] // `get` is stable since 1.70.0.
static THREAD_SND: Sender<Command> = SND.get().unwrap().lock().unwrap().clone();
}

Expand Down
1 change: 0 additions & 1 deletion examples/size_aware_eviction_sync.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use moka::sync::Cache;
use std::convert::TryInto;

fn main() {
let cache = Cache::builder()
Expand Down
2 changes: 0 additions & 2 deletions src/common.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
use std::convert::TryInto;

pub(crate) mod builder_utils;
pub(crate) mod concurrent;
pub(crate) mod deque;
Expand Down
1 change: 0 additions & 1 deletion src/future/cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,6 @@ use std::sync::atomic::{AtomicBool, Ordering};
/// // tokio = { version = "1", features = ["rt-multi-thread", "macros" ] }
/// // futures-util = "0.3"
///
/// use std::convert::TryInto;
/// use moka::future::Cache;
///
/// #[tokio::main]
Expand Down
1 change: 0 additions & 1 deletion src/sync/cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,6 @@ use std::{
/// # Example: Size-based Eviction
///
/// ```rust
/// use std::convert::TryInto;
/// use moka::sync::Cache;
///
/// // Evict based on the number of entries in the cache.
Expand Down

0 comments on commit a0f81f7

Please sign in to comment.