Skip to content

Commit

Permalink
Clippy fix
Browse files Browse the repository at this point in the history
  • Loading branch information
fintelia committed Feb 9, 2025
1 parent fd94496 commit 686939b
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/image_reader/free_functions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,15 +173,12 @@ pub(crate) fn guess_format_impl(buffer: &[u8]) -> Option<ImageFormat> {
if buffer.starts_with(signature) {
return Some(format);
}
} else if buffer.len() >= signature.len() {
if buffer
} else if buffer.len() >= signature.len() && buffer
.iter()
.zip(signature.iter())
.zip(mask.iter().chain(iter::repeat(&0xFF)))
.all(|((&byte, &sig), &mask)| byte & mask == sig)
{
return Some(format);
}
.all(|((&byte, &sig), &mask)| byte & mask == sig) {
return Some(format);
}
}

Expand Down

0 comments on commit 686939b

Please sign in to comment.