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

Open
github-bot wants to merge 1 commit from github-bot/gh-266 into main AGit
Owner

@⁠ySKELLETONX on GitHub · 2026-11-26 14:42 UTC · original
ySKELLETONX:ci/clippy-victory-gpu → main · +75 −32 · 16 files · 1 commits · open

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.

**@⁠ySKELLETONX** on GitHub · 2026-11-26 14:42 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/pull/266) `ySKELLETONX:ci/clippy-victory-gpu` → `main` · +75 −32 · 16 files · 1 commits · open 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.
CI runs `cargo clippy --workspace --all-targets -- -D warnings`, then the
same with `--all-features`, and has failed on main since 01aadd1. #3 makes
victory-shader pass; past it clippy stopped at 46 lints in victory-gpu, then
one in victory-hle, then 7 more in victory-gpu's diagnostics build. No
behaviour changes.

- 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`.
- `view_count` reads the buffer member of a view's union only for buffer
  views: clippy's `then_some` would have read it for every view, so it is
  an `if` instead, and its SAFETY comment still holds.
- Used only by diagnostics: `describe_slot` and `watch::layout` are built
  with the feature; `frame::wait`'s `wait` is allowed unused without it (the
  machine fix renamed it, which broke the diagnostics build that logs it).
- `Shader::hair` is read only where draws are skipped, which is in the
  diagnostics build alone: allowed unused without the feature, with a note
  that a release build runs these programs.
- SAFETY comments on 9 unsafe blocks (card.rs, host.rs, shadow.rs).
- Local allows: `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).
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 14:49:04 +00:00
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/266/head:github-bot/gh-266'
git switch 'github-bot/gh-266'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-266'
git switch 'github-bot/gh-266'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-266'
git switch 'github-bot/gh-266'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-266'
git switch 'main'
git merge --squash 'github-bot/gh-266'
git switch 'main'
git merge --ff-only 'github-bot/gh-266'
git switch 'main'
git merge 'github-bot/gh-266'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.