Skip to content

clippy: the lints that are not dead code, so the CI step gets past victory-shader - #3

Open
erdemcisse wants to merge 1 commit into
RedLightDOWN:mainfrom
erdemcisse:clippy/mechanical-lints
Open

erdemcisse wants to merge 1 commit into
RedLightDOWN:mainfrom
erdemcisse:clippy/mechanical-lints

Conversation

@erdemcisse

Copy link
Copy Markdown

What and why

cargo clippy --workspace --all-targets --locked -- -D warnings has never passed on this repo, and CI stops there, so cargo test --workspace has never run (issue #2). The two errors that stop it first are mechanical, in victory-shader:

error: manual implementation of `.is_multiple_of()`
  --> crates/victory-shader/src/emit/water_tile_slots.rs:80:50
80 |         debug_assert!(new.len() <= body.len() && body.len() % 4 == 0);

error: returning the result of a `let` binding from a block
  --> crates/victory-shader/src/emit/mod.rs:2893   (div_fixup_corner_fixture)

With those two out of the way, the next 29 errors are in victory-gpu: 27 dead_code and these three, which need no decision from anyone:

file was now
crates/victory-gpu/src/shadow.rs:1714 if turns % 16 == 0 if turns.is_multiple_of(16)
crates/victory-gpu/src/texture.rs:1562 is_all_zero(&read) is_all_zero(read)
crates/victory-gpu/src/watch.rs:3946 open(&mut g, …) open(&g, …) (+ the mut the guard no longer needs)

open has always taken &Guards, so the &mut only ever coerced; is_multiple_of is x % n == 0; the & clippy points at is the one the compiler dereferences anyway. No behaviour change.

What is left is deliberately not here. The 27 remaining errors are all dead_code: the unused "meta store" (section 3. SHADER METADATA SIDECAR CACHE: ShaderMeta, MetaStore, META, META_MAGIC, meta_enabled, encode/decode_resource_kind, encode/decode_root, load_meta_file, meta_store, shader_meta_get/put, flush_meta_now) plus mix64, fast_hash_128*, two log_stats, and the watch.rs port counters — code that Revert "merge: take non-RT performance and stability work from Leonida Continued" (732113e) left behind. Deleting, wiring up or cfg-gating it is your call, not mine to guess; issue #2 lists every item with its line.

Tested

Rust 1.98.1 (the pin in rust-toolchain.toml), x86_64-pc-windows-msvc, Windows 11 10.0.26100, MSVC 14.44.35207 — the same toolchain and target as the workflow.

cargo clippy --workspace --all-targets --locked -- -D warnings
  -> only `dead_code` errors remain; no `is_multiple_of`, no needless borrow, no needless `mut`, no `let`-and-return

cargo test -p victory-gpu --lib --locked -- --test-threads=1
  -> 457 passed; 0 failed; 36 ignored

cargo test -p victory-gpu --lib --locked            (2 of 3 runs)
  -> 457 passed; 1 run hit one of the pre-existing flaky `watch` tests
     (`port7_tests::no_write_is_lost_with_port_7`); reported separately, not touched here

cargo test --workspace --locked                     (all other crates)
  -> 26 + 2 + 16 + 48 + 3 passed

--all-features has more of the same kind (a never-constructed faultbook::Unlocked variant, alone_line, one more is_multiple_of) — same dead-code question, same issue.

GPUs tested: n/a — lints and unit tests, no device workload.

AI-assisted: yes — DeepSeek Harness (lead agent).

…ctory-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 RedLightDOWN#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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant