Skip to content

LightCraft: An open-source non-destructive photo editor written by scratch in pure Rust

HEIC: as_chunks for 16-bit samples (clippy 1.99, caught by the new heif CI step)

Brandon Thomasd0749ed7a924
diff --git a/crates/codecs/src/heif.rs b/crates/codecs/src/heif.rs
index cb451f0c4..fe91c0af5 100644
--- a/crates/codecs/src/heif.rs
+++ b/crates/codecs/src/heif.rs
@@ -54,8 +54,8 @@ pub(crate) fn decode(bytes: &[u8], opts: &DecodeOptions) -> Result<Decoded> {
// The decoder re-reads the container; trust its output's shape, not the probe's.
let buf = if decoded.sixteen_bit {
let mut v = Vec::with_capacity(decoded.data.len() / 2);
- for pair in decoded.data.chunks_exact(2).filter_map(|p| <[u8; 2]>::try_from(p).ok()) {
- v.push(u16::from_ne_bytes(pair));
+ for pair in decoded.data.as_chunks::<2>().0 {
+ v.push(u16::from_ne_bytes(*pair));
}
Buf::U16(v)
} else {