Skip to content

Commit

Permalink
Fix Clippy and compiler warnings
Browse files Browse the repository at this point in the history
- 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)
  • Loading branch information
tatsuya6502 committed Feb 11, 2024
1 parent 612ead1 commit e66b7e3
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/future/cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<T> = Result<T, Arc<MyError>>;

Expand Down Expand Up @@ -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<T> = Result<T, Arc<MyError>>;

Expand Down
4 changes: 2 additions & 2 deletions src/sync/cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<T> = Result<T, Arc<MyError>>;

Expand Down Expand Up @@ -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<T> = Result<T, Arc<MyError>>;

Expand Down
4 changes: 2 additions & 2 deletions src/sync/segment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion src/sync_base/base_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ impl<K, V, S> Clone for BaseCache<K, V, S> {
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(),
}
}
}
Expand Down
3 changes: 3 additions & 0 deletions src/unsync/cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down

0 comments on commit e66b7e3

Please sign in to comment.