From cae67546dd8db672706698a3ad897b758b0339f3 Mon Sep 17 00:00:00 2001 From: Brandon Thomas Date: Fri, 9 Oct 2026 00:45:44 -0400 Subject: [PATCH] Media: checked offset and as_chunks_mut in the stereo interleave (#305 follow-up) clippy 1.99 flags chunks_exact_mut with a constant size; the skip offset was also an unchecked slice. Co-Authored-By: Claude Opus 5.5 --- crates/media/src/pool.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/crates/media/src/pool.rs b/crates/media/src/pool.rs index e9cf4bc0..8cdb6261 100644 --- a/crates/media/src/pool.rs +++ b/crates/media/src/pool.rs @@ -684,9 +684,10 @@ fn read_stereo(src: &SharedSource, path: &str, s0: i64, frames: usize, rate: u32 } }; let (Some(l), Some(r)) = (buf.channels.first(), buf.channels.get(1).or(buf.channels.first())) else { return out }; - for (o, (a, b)) in out[skip * 2..].chunks_exact_mut(2).zip(l.iter().zip(r)) { - o[0] = *a; - o[1] = *b; + let Some(dst) = skip.checked_mul(2).and_then(|i| out.get_mut(i..)) else { return out }; + for ([o0, o1], (a, b)) in dst.as_chunks_mut::<2>().0.iter_mut().zip(l.iter().zip(r)) { + *o0 = *a; + *o1 = *b; } out }