diff --git a/src/hasher.rs b/src/hasher.rs index 5a739a4..30625db 100644 --- a/src/hasher.rs +++ b/src/hasher.rs @@ -14,11 +14,9 @@ const BUFFER_SIZE: usize = 4096 * 8; fn hash_file(filename: &str) -> anyhow::Result> { let filesize = usize::try_from(file_size(filename)?).ok(); - if let Some(size) = filesize { - if size <= BUFFER_SIZE { - // this file is smaller than the buffer size, so we can hash it all at once - return hash_file_whole::(filename); - } + if filesize.map_or(false, |size| size <= BUFFER_SIZE) { + // this file is smaller than the buffer size, so we can hash it all at once + return hash_file_whole::(filename); } let file = File::open(filename)?;