From b636dad56e15ffc5df5a3ee8d7892257bedff140 Mon Sep 17 00:00:00 2001 From: aiongg Date: Sat, 24 Oct 2026 21:03:28 +0000 Subject: [PATCH] jpeg: read the reference PPM with as_chunks --- crates/jpeg/tests/conformance.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/jpeg/tests/conformance.rs b/crates/jpeg/tests/conformance.rs index 2e81620f..3e449263 100644 --- a/crates/jpeg/tests/conformance.rs +++ b/crates/jpeg/tests/conformance.rs @@ -73,7 +73,7 @@ fn ppm16(bytes: &[u8]) -> (u32, u32, u32, Vec) { let num = |s: &str| s.parse::().unwrap_or_else(|e| panic!("PPM header {s}: {e}")); let (w, h, maxval) = (num(&fields[1]), num(&fields[2]), num(&fields[3])); let data = &bytes[at + 1..]; - let px: Vec = data.chunks_exact(2).map(|c| u16::from_be_bytes([c[0], c[1]])).collect(); + let px: Vec = data.as_chunks::<2>().0.iter().map(|&c| u16::from_be_bytes(c)).collect(); assert_eq!(px.len(), (w * h * 3) as usize); (w, h, maxval, px) }