From 3cb10fe27681e030e425493a127de1e032b85781 Mon Sep 17 00:00:00 2001 From: Anees Iqbal Date: Sun, 8 Nov 2026 00:44:06 -0800 Subject: [PATCH] tiled_texture_device: is_multiple_of and no usize-to-usize cast (clippy under the device cfgs) Development's lint leg at 95b0042865 (um790 m3-max-7568) failed clippy --cfg m2v_gpu and --cfg m2v_cpu_icd on two lints in the new device test, which compiles only under those cfgs: manual_is_multiple_of in checker() and unnecessary_cast in samples(). Plain clippy, fmt and rustdoc passed. --- crates/metal2vulkan-runtime/src/tests/tiled_texture_device.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/metal2vulkan-runtime/src/tests/tiled_texture_device.rs b/crates/metal2vulkan-runtime/src/tests/tiled_texture_device.rs index 5e25560c5..8dbfea0e2 100644 --- a/crates/metal2vulkan-runtime/src/tests/tiled_texture_device.rs +++ b/crates/metal2vulkan-runtime/src/tests/tiled_texture_device.rs @@ -141,7 +141,7 @@ fn packed((width, height): (u64, u64), of: impl Fn(u64, u64) -> [u8; 4]) -> Vec< /// checkerboard of 0 and 255 a texel, which a 2x2 box averages to 127 or 128; green one value a 2x2 /// block, which it keeps; red 0x40 and alpha 255. fn checker(x: u64, y: u64) -> [u8; 4] { - let blue = if (x + y) % 2 == 0 { 0 } else { 0xff }; + let blue = if (x + y).is_multiple_of(2) { 0 } else { 0xff }; let green = ((x / 2) * 9 + (y / 2) * 5) as u8; [blue, green, 0x40, 0xff] } @@ -208,7 +208,7 @@ impl Rig { let bytes = read(out); std::array::from_fn(|point| { std::array::from_fn(|channel| { - let at = (point * 16 + channel * 4) as usize; + let at = point * 16 + channel * 4; f32::from_le_bytes(bytes[at..at + 4].try_into().unwrap()) }) })