From b9125ddb6561b00ff259de5b52058a501007f61d Mon Sep 17 00:00:00 2001 From: LGUG2Z Date: Sat, 31 Oct 2026 12:43:21 -0700 Subject: [PATCH] style(mac): sample the capture spike's pixels with chunks(4) and a length filter (clippy) examples/capture_spike.rs iterated bytes.chunks_exact(4), which clippy flags as chunks_exact_with_const_size on 1.93 and as chunks_exact_to_as_chunks on 1.99 (the allow name differs between the two, so an allow cannot serve both). chunks(4).filter(len == 4) visits the same full pixels in the same order and still drops a trailing partial one; the spike is an example binary, not the daemon. No behaviour change. Verified: fake-CC cargo clippy --locked --target aarch64-apple-darwin --workspace --all-targets -D warnings: clean (whole workspace). Verified on the Mini: not yet. --- komorebi-for-mac/komorebi/examples/capture_spike.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/komorebi-for-mac/komorebi/examples/capture_spike.rs b/komorebi-for-mac/komorebi/examples/capture_spike.rs index c2d93b16..747d8170 100644 --- a/komorebi-for-mac/komorebi/examples/capture_spike.rs +++ b/komorebi-for-mac/komorebi/examples/capture_spike.rs @@ -46,7 +46,8 @@ fn sample(data: &CFData) -> (f64, f64) { let bytes = data.to_vec(); let (mut total, mut visible, mut lit) = (0usize, 0usize, 0usize); - for pixel in bytes.chunks_exact(4).step_by(37) { + // a trailing partial pixel (a buffer that is not a multiple of 4) is dropped, as chunks_exact did + for pixel in bytes.chunks(4).filter(|pixel| pixel.len() == 4).step_by(37) { total += 1; if pixel[3] > 0 { visible += 1;