From e66b7e311f402d41be75b3b9cea2c3a3a7b87811 Mon Sep 17 00:00:00 2001 From: Tatsuya Kawano Date: Sun, 11 Feb 2024 02:17:53 +0000 Subject: [PATCH] Fix Clippy and compiler warnings - Fix beta Clippy warnings - clippy 0.1.77 (f2048098a1c 2024-02-09) - Fix beta compiler warnings - rustc 1.77.0-beta.2 (f2048098a 2024-02-09) --- src/future/cache.rs | 4 ++-- src/sync/cache.rs | 4 ++-- src/sync/segment.rs | 4 ++-- src/sync_base/base_cache.rs | 2 +- src/unsync/cache.rs | 3 +++ 5 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/future/cache.rs b/src/future/cache.rs index 0797d56c..81833e46 100644 --- a/src/future/cache.rs +++ b/src/future/cache.rs @@ -3059,7 +3059,7 @@ mod tests { // Note that MyError does not implement std::error::Error trait // like anyhow::Error. #[derive(Debug)] - pub struct MyError(String); + pub struct MyError(#[allow(dead_code)] String); type MyResult = Result>; @@ -3194,7 +3194,7 @@ mod tests { // Note that MyError does not implement std::error::Error trait // like anyhow::Error. #[derive(Debug)] - pub struct MyError(String); + pub struct MyError(#[allow(dead_code)] String); type MyResult = Result>; diff --git a/src/sync/cache.rs b/src/sync/cache.rs index 2bb30f42..3152e95b 100644 --- a/src/sync/cache.rs +++ b/src/sync/cache.rs @@ -3086,7 +3086,7 @@ mod tests { // Note that MyError does not implement std::error::Error trait like // anyhow::Error. #[derive(Debug)] - pub struct MyError(String); + pub struct MyError(#[allow(dead_code)] String); type MyResult = Result>; @@ -3225,7 +3225,7 @@ mod tests { // Note that MyError does not implement std::error::Error trait like // anyhow::Error. #[derive(Debug)] - pub struct MyError(String); + pub struct MyError(#[allow(dead_code)] String); type MyResult = Result>; diff --git a/src/sync/segment.rs b/src/sync/segment.rs index fbba8a12..b8346ac1 100644 --- a/src/sync/segment.rs +++ b/src/sync/segment.rs @@ -740,8 +740,8 @@ where seg_max_capacity, seg_init_capacity, build_hasher.clone(), - weigher.as_ref().map(Arc::clone), - eviction_listener.as_ref().map(Arc::clone), + weigher.clone(), + eviction_listener.clone(), eviction_listener_conf.clone(), time_to_live, time_to_idle, diff --git a/src/sync_base/base_cache.rs b/src/sync_base/base_cache.rs index d56bf305..9131847d 100644 --- a/src/sync_base/base_cache.rs +++ b/src/sync_base/base_cache.rs @@ -73,7 +73,7 @@ impl Clone for BaseCache { inner: Arc::clone(&self.inner), read_op_ch: self.read_op_ch.clone(), write_op_ch: self.write_op_ch.clone(), - housekeeper: self.housekeeper.as_ref().map(Arc::clone), + housekeeper: self.housekeeper.clone(), } } } diff --git a/src/unsync/cache.rs b/src/unsync/cache.rs index 1b4778ef..26597cad 100644 --- a/src/unsync/cache.rs +++ b/src/unsync/cache.rs @@ -968,6 +968,9 @@ where break; } + // clippy::map_clone will give us a false positive warning here. + // Version: clippy 0.1.77 (f2048098a1c 2024-02-09) in Rust 1.77.0-beta.2 + #[allow(clippy::map_clone)] let key = probation .peek_front() .map(|node| Rc::clone(&node.element.key));