spikes/gpui: clippy -D warnings clean on nightly (as_chunks, bounded range)
Nightly's clippy flagged the two chunks_exact(4) loops of common/src/bgra.rs (chunks_exact_to_as_chunks): both now use as_chunks::<4>() and as_chunks_mut::<4>() (stable since 1.88). Behind them, because clippy stops at the first crate that fails, it flags the raw source's `for n in 0u64..` in video/src/main.rs (for_unbounded_range): now `0..=u64::MAX`, the same loop. `cargo clippy --locked --all-targets -- -D warnings` is clean on 1.95.0 and on nightly 2026-10-24 (through shell.sh); the README and the report's clippy sentence say so. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
5c36aae55e
commit
24069ac170
4 files changed
+17
-10
No files matched your search
@@ -71,8 +71,10 @@ pub fn to_bgra_ref(frame: &FrameRef<'_>, out: &mut [u8], stride: usize) -> Resul
|
||||
PixelsRef::Rgba(p) => {
|
||||
for y in 0..h as usize {
|
||||
let (src, dst) = (p.row(y, row), &mut out[y * stride..y * stride + row]);
|
||||
for (d, s) in dst.chunks_exact_mut(4).zip(src.chunks_exact(4)) {
|
||||
d.copy_from_slice(&[s[2], s[1], s[0], 255]);
|
||||
// `row` is a whole number of pixels: there is no remainder.
|
||||
let (dst, src) = (dst.as_chunks_mut::<4>().0, src.as_chunks::<4>().0);
|
||||
for (d, s) in dst.iter_mut().zip(src) {
|
||||
*d = [s[2], s[1], s[0], 255];
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
@@ -113,8 +115,8 @@ mod tests {
|
||||
let mut bgra = vec![0; 64 * 36 * 4];
|
||||
convert::to_rgba(frame, &mut rgba, 64 * 4).unwrap();
|
||||
to_bgra(frame, &mut bgra, 64 * 4).unwrap();
|
||||
for (r, b) in rgba.chunks_exact(4).zip(bgra.chunks_exact(4)) {
|
||||
assert_eq!([r[2], r[1], r[0], r[3]], b);
|
||||
for (r, b) in rgba.as_chunks::<4>().0.iter().zip(bgra.as_chunks::<4>().0) {
|
||||
assert_eq!([r[2], r[1], r[0], r[3]], *b);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user