Clippy: victory-gpu and victory-hle pass with -D warnings, the diagnostics build too (CI, with #3) #266

Open
ySKELLETONX wants to merge 1 commit from upstream-pr/266 into main
ySKELLETONX commented 2026-11-26 14:42:09 +00:00 (Migrated from github.com)

Imported from Belobug/VIctory-Belobug-AMD. Originally posted by ySKELLETONX on 2026-11-26T14:42:09Z.


CI runs cargo clippy --workspace --all-targets -- -D warnings, then the same with --all-features, then cargo test --workspace, and has failed at the first clippy step on every main push since 01aadd1, so the tests never run. #3 makes victory-shader pass; past it, clippy stopped at 46 lints in victory-gpu, then 1 in victory-hle, then 7 more in victory-gpu's diagnostics build. This clears those. With #3 and this, both clippy steps pass (checked by merging #3 on top). No behaviour changes.

What changes

  • Clippy's suggested fixes: needless borrows (list.rs, depth_bounds_test.rs), is_multiple_of, as_chunks::<32>() for chunks_exact(32), parentheses around given * PAGE >> 20, a cast to the same type, sort_unstable_by_key with Reverse for a descending sort_unstable_by.
  • Two machine fixes not taken:
    • In view_count, then_some would read the buffer member of the view's union for every view. It is an if instead, so it is read only for buffer views and the SAFETY comment still holds.
    • frame::wait's wait was renamed _wait, which broke the diagnostics build that logs it. It is allowed unused without the feature instead.
  • Used only by diagnostics: describe_slot and watch::layout are built only with the feature.
  • SAFETY comments on 9 unsafe blocks (card.rs, host.rs, shadow.rs).
  • Local allows instead of reshaping your code: too_many_arguments on dispatch_hash; type_complexity on 9 locals, fields and signatures; items_after_test_module on xmem's tests (moving the memory log above them would conflict with #14, #16 and #39); dead_code on profile::RSP and on queue::test_queue (its last test went in 161dc7f).

Checked (Windows 11, Ryzen 7 5700X3D + RX 7600 XT, no game data)

  • With #3 merged: cargo clippy --workspace --all-targets --locked -- -D warnings and the same with --all-features: both pass
  • cargo test -p victory-gpu --lib: 113 passed; with --features diagnostics: 116 passed
  • cargo build --profile diag -p victory --features diagnostics: builds
  • victory-hle: the same 5 xmem failures as on main
  • Merges cleanly with #3, #14, #16, #39, #115, #219, #229, #253, #258. It conflicts with #52, which already conflicts with main; it went after the same victory-gpu lints, credit to @towiice.

What still keeps CI red after this, in the Tests step

  • 5 xmem tests: #14 or #16
  • victory-shader's test binary dying in d3d10warp.dll: #140
  • xtask's repository_passes_policy: crates/victory-shader/src/emit/lower.rs is 630,716 bytes, over the 512 KiB limit. An entry in EXCEPTIONS or splitting the file is your call (the README already mentions it).
  • Intermittent: query::tests::occlusion_queries_around_draws_not_run_stay_visible (#116) and the watch tests (#102, #115)

One thing I noticed (not changed here)
Shader::hair (hair strands, and idle_without_rays, including the program that activates the screen probes' rays) is read only by skipped_shader / is_skipped, and all three callers in draw.rs are #[cfg(feature = "diagnostics")]. So a release build runs these programs, and only the diagnostics build leaves them out. The README says the probes' ray program "is left out on purpose while rays do not run". If that should hold for release builds too, the skip needs to move out of the diagnostics cfg; I left it as it is and only noted it beside the field.

<!-- greyfinch-sync:Belobug/VIctory-Belobug-AMD:issue:6629042522 --> Imported from [Belobug/VIctory-Belobug-AMD](https://github.com/Belobug/VIctory-Belobug-AMD/pull/266). Originally posted by [ySKELLETONX](https://github.com/ySKELLETONX) on 2026-11-26T14:42:09Z. --- CI runs `cargo clippy --workspace --all-targets -- -D warnings`, then the same with `--all-features`, then `cargo test --workspace`, and has failed at the first clippy step on every `main` push since 01aadd1, so the tests never run. #3 makes `victory-shader` pass; past it, clippy stopped at 46 lints in `victory-gpu`, then 1 in `victory-hle`, then 7 more in `victory-gpu`'s diagnostics build. This clears those. **With #3 and this, both clippy steps pass** (checked by merging #3 on top). No behaviour changes. **What changes** - Clippy's suggested fixes: needless borrows (`list.rs`, `depth_bounds_test.rs`), `is_multiple_of`, `as_chunks::<32>()` for `chunks_exact(32)`, parentheses around `given * PAGE >> 20`, a cast to the same type, `sort_unstable_by_key` with `Reverse` for a descending `sort_unstable_by`. - Two machine fixes not taken: - In `view_count`, `then_some` would read the buffer member of the view's union for every view. It is an `if` instead, so it is read only for buffer views and the SAFETY comment still holds. - `frame::wait`'s `wait` was renamed `_wait`, which broke the diagnostics build that logs it. It is allowed unused without the feature instead. - Used only by diagnostics: `describe_slot` and `watch::layout` are built only with the feature. - SAFETY comments on 9 unsafe blocks (`card.rs`, `host.rs`, `shadow.rs`). - Local allows instead of reshaping your code: `too_many_arguments` on `dispatch_hash`; `type_complexity` on 9 locals, fields and signatures; `items_after_test_module` on xmem's tests (moving the memory log above them would conflict with #14, #16 and #39); `dead_code` on `profile::RSP` and on `queue::test_queue` (its last test went in 161dc7f). **Checked** (Windows 11, Ryzen 7 5700X3D + RX 7600 XT, no game data) - With #3 merged: `cargo clippy --workspace --all-targets --locked -- -D warnings` and the same with `--all-features`: both pass - `cargo test -p victory-gpu --lib`: 113 passed; with `--features diagnostics`: 116 passed - `cargo build --profile diag -p victory --features diagnostics`: builds - `victory-hle`: the same 5 `xmem` failures as on `main` - Merges cleanly with #3, #14, #16, #39, #115, #219, #229, #253, #258. It conflicts with #52, which already conflicts with `main`; it went after the same `victory-gpu` lints, credit to @towiice. **What still keeps CI red after this, in the Tests step** - 5 `xmem` tests: #14 or #16 - `victory-shader`'s test binary dying in `d3d10warp.dll`: #140 - `xtask`'s `repository_passes_policy`: `crates/victory-shader/src/emit/lower.rs` is 630,716 bytes, over the 512 KiB limit. An entry in `EXCEPTIONS` or splitting the file is your call (the README already mentions it). - Intermittent: `query::tests::occlusion_queries_around_draws_not_run_stay_visible` (#116) and the watch tests (#102, #115) **One thing I noticed (not changed here)** `Shader::hair` (hair strands, and `idle_without_rays`, including the program that activates the screen probes' rays) is read only by `skipped_shader` / `is_skipped`, and all three callers in `draw.rs` are `#[cfg(feature = "diagnostics")]`. So a release build runs these programs, and only the diagnostics build leaves them out. The README says the probes' ray program "is left out on purpose while rays do not run". If that should hold for release builds too, the skip needs to move out of the diagnostics cfg; I left it as it is and only noted it beside the field.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/266:upstream-pr/266'
git switch 'upstream-pr/266'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/266'
git switch 'upstream-pr/266'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/266'
git switch 'upstream-pr/266'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/266'
git switch 'main'
git merge --squash 'upstream-pr/266'
git switch 'main'
git merge --ff-only 'upstream-pr/266'
git switch 'main'
git merge 'upstream-pr/266'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
Belobug/VIctory-Belobug-AMD!266
No description provided.