From 78558db383bfe60c02215dbbd86ce79b2f0d94c6 Mon Sep 17 00:00:00 2001 From: erdemcisse Date: Tue, 1 Dec 2026 22:52:39 +0100 Subject: [PATCH] clippy: the lints that are not dead code, so the CI step gets past victory-shader `cargo clippy --workspace --all-targets --locked -- -D warnings` has never passed here, and the two that stop it first are in `victory-shader`: * water_tile_slots.rs:80 `body.len() % 4 == 0` -> `.is_multiple_of(4)` * emit/mod.rs:2893 `let l = ...; l` -> return the call With those out of the way the next 27 errors are all `dead_code` in `victory-gpu` (the unused meta store the revert of the Leonida Continued merge left in `turbo.rs`, the port-7 counters in `watch.rs`, two `log_stats`), and whether that code is deleted, wired up or feature-gated is the owner's call: issue #2 has the inventory. What is left here is mechanical and has no such question: * shadow.rs:1714 `turns % 16 == 0` -> `.is_multiple_of(16)` * texture.rs:1562 `is_all_zero(&read)` -> `is_all_zero(read)` * watch.rs:3946 `open(&mut g, ...)` -> `open(&g, ...)` (`open` takes `&Guards`), and the `mut` on the guard it was borrowed from goes with it No behaviour change: `is_multiple_of` is `x % n == 0`, the borrow clippy points at is the one the compiler dereferences anyway, and `open` has always taken a shared reference. --- crates/victory-gpu/src/shadow.rs | 2 +- crates/victory-gpu/src/texture.rs | 2 +- crates/victory-gpu/src/watch.rs | 4 ++-- crates/victory-shader/src/emit/mod.rs | 5 ++--- crates/victory-shader/src/emit/water_tile_slots.rs | 2 +- 5 files changed, 7 insertions(+), 8 deletions(-) diff --git a/crates/victory-gpu/src/shadow.rs b/crates/victory-gpu/src/shadow.rs index 1094038..783dda4 100644 --- a/crates/victory-gpu/src/shadow.rs +++ b/crates/victory-gpu/src/shadow.rs @@ -1711,7 +1711,7 @@ fn workers() -> &'static Workers { std::hint::spin_loop(); } turns = turns.wrapping_add(1); - if turns % 16 == 0 { + if turns.is_multiple_of(16) { std::thread::yield_now(); } } diff --git a/crates/victory-gpu/src/texture.rs b/crates/victory-gpu/src/texture.rs index a108f69..046c79c 100644 --- a/crates/victory-gpu/src/texture.rs +++ b/crates/victory-gpu/src/texture.rs @@ -1559,7 +1559,7 @@ impl Staging { return false; } last.hash = Some(hash); - if crate::turbo::is_all_zero(&read) { + if crate::turbo::is_all_zero(read) { return false; } self.detile(read); diff --git a/crates/victory-gpu/src/watch.rs b/crates/victory-gpu/src/watch.rs index 5ec21d6..0edf8ce 100644 --- a/crates/victory-gpu/src/watch.rs +++ b/crates/victory-gpu/src/watch.rs @@ -3942,8 +3942,8 @@ pub fn title_memory_made_real(at: usize, len: usize) { if len == 0 { return; } - let mut g = guards(); - open(&mut g, at, at.saturating_add(len)); + let g = guards(); + open(&g, at, at.saturating_add(len)); } /// Registers the handler that takes writes to guarded blocks, once, ahead diff --git a/crates/victory-shader/src/emit/mod.rs b/crates/victory-shader/src/emit/mod.rs index 1edeeef..47f32e9 100644 --- a/crates/victory-shader/src/emit/mod.rs +++ b/crates/victory-shader/src/emit/mod.rs @@ -2890,7 +2890,7 @@ mod tests { let res = crate::resource::track(&p, &native.layout, native.stage, None).unwrap(); let io = crate::io::raise(&p, &native).unwrap(); let st = crate::structure::structure(&p).unwrap(); - let l = super::lower::lower(&super::lower::Parts { + super::lower::lower(&super::lower::Parts { native: &native, p: &p, st: &st, @@ -2901,8 +2901,7 @@ mod tests { prims: Vec::new(), mesh_stride: 0, }) - .unwrap(); - l + .unwrap() } #[test] diff --git a/crates/victory-shader/src/emit/water_tile_slots.rs b/crates/victory-shader/src/emit/water_tile_slots.rs index acbcbcc..2deaac1 100644 --- a/crates/victory-shader/src/emit/water_tile_slots.rs +++ b/crates/victory-shader/src/emit/water_tile_slots.rs @@ -77,7 +77,7 @@ pub(super) fn rewrite(native: &mut NativeProgram) -> bool { new.extend_from_slice(&before[piece.clone()]); } let body = &mut native.code[append.body]; - debug_assert!(new.len() <= body.len() && body.len() % 4 == 0); + debug_assert!(new.len() <= body.len() && body.len().is_multiple_of(4)); body[..new.len()].copy_from_slice(&new); for word in body[new.len()..].chunks_exact_mut(4) { word.copy_from_slice(&nop);