mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-11-16 13:51:19 +01:00
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.
This commit is contained in:
1 parent
a35573d8eb
commit
b9125ddb65
1 file changed
+2
-1
@@ -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;
|
||||
|
||||
Reference in new issue
Block a user