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, ) }