From 6ba17d57df00b765236b3a509ee9f67cf8a683ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn-Michael=20Miehe?= <40151420+ldericher@users.noreply.github.com> Date: Thu, 3 Jul 2025 19:13:54 +0000 Subject: [PATCH] clippy fix --- src/error.rs | 9 +++++---- src/file/checked.rs | 2 +- src/file/mod.rs | 2 +- src/file/uploading.rs | 2 +- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/error.rs b/src/error.rs index 58211b7..fadb562 100644 --- a/src/error.rs +++ b/src/error.rs @@ -121,15 +121,16 @@ impl Error { } } - pub fn is_mismatch(&self, has_expected: E, has_actual: A) -> bool + pub fn is_mismatch(&self, want_expected: E, want_actual: A) -> bool where - String: PartialEq + PartialEq, + E: AsRef, + A: AsRef, { matches!( self, Self::Mismatch { expected, actual } - if *expected == has_expected - && *actual == has_actual + if expected == want_expected.as_ref() + && actual == want_actual.as_ref() ) } diff --git a/src/file/checked.rs b/src/file/checked.rs index af52130..5804afa 100644 --- a/src/file/checked.rs +++ b/src/file/checked.rs @@ -104,7 +104,7 @@ impl FileTrait for Checked { super::check_hash( &self.path, self.size, - self.hash.as_ref().map(String::as_str), + self.hash.as_deref(), on_progress, ) } diff --git a/src/file/mod.rs b/src/file/mod.rs index be26361..06a2177 100644 --- a/src/file/mod.rs +++ b/src/file/mod.rs @@ -16,7 +16,7 @@ pub use uploading::Uploading; const HASH_CHUNK_SIZE: usize = 4 * 1024 * 1024; /// compute hash for a file given its path. -/// Hash function: BLAKE2b, 512 bit +/// Hash function: `BLAKE2b`, 512 bit /// /// # Params /// diff --git a/src/file/uploading.rs b/src/file/uploading.rs index 9b76419..2050475 100644 --- a/src/file/uploading.rs +++ b/src/file/uploading.rs @@ -107,7 +107,7 @@ impl FileTrait for Uploading { super::check_hash( &self.path, self.size, - self.hash.as_ref().map(String::as_str), + self.hash.as_deref(), on_progress, ) }