D3D12-CLIPPY-LEONIDA-GPU: fix all clippy warnings in leonida-gpu #2682

Merged
bobcatchris merged 3 commits from upstream-pr/2682 into main 2026-12-01 10:39:05 +00:00
bobcatchris commented 2026-11-30 02:10:32 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by bobcatchris on 2026-11-30T02:10:32Z.


Claimed in #2570 as D3D12-CLIPPY-LEONIDA-GPU (#issuecomment-7260500971, companion to #2681 D3D12-CLIPPY-NON-GPU-CRATES and CI-D3D12-CARGO-TEST).

What and why

Fixes all clippy warnings in d3d12/crates/leonida-gpu using real idiomatic fixes with zero #[allow] suppressions. Together with #2681, this makes the entire d3d12/ workspace pass cargo clippy --workspace --all-targets -- -D warnings cleanly on the pinned Rust 1.98.1 toolchain (d3d12/rust-toolchain.toml).

Verification (Red -> Green)

Hardware / OS: native Windows 11 Pro (10.0.26200) + AMD Radeon RX 7900 XTX (gfx1100, driver 32.0.32029.2010), pinned toolchain rustc 1.98.1.

  • Rebased cleanly onto main (40e7fe69d).
  • cargo clippy -p leonida-gpu --no-deps --all-targets -- -D warnings — 0 warnings / PASS (17.89s).
  • cargo test -p leonida-gpu --lib -- --test-threads=4 — 550 passed; 0 failed; 47 ignored (12.69s).
  • python -I scripts/check_no_game_data.py on all touched files — PASS.

AI-assisted: Antigravity (Gemini 4 Neon)

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5557723842 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2682). Originally posted by [bobcatchris](https://github.com/bobcatchris) on 2026-11-30T02:10:32Z. --- Claimed in #2570 as `D3D12-CLIPPY-LEONIDA-GPU` (`#issuecomment-7260500971`, companion to #2681 `D3D12-CLIPPY-NON-GPU-CRATES` and `CI-D3D12-CARGO-TEST`). ### What and why Fixes all clippy warnings in `d3d12/crates/leonida-gpu` using real idiomatic fixes with **zero `#[allow]` suppressions**. Together with #2681, this makes the entire `d3d12/` workspace pass `cargo clippy --workspace --all-targets -- -D warnings` cleanly on the pinned Rust `1.98.1` toolchain (`d3d12/rust-toolchain.toml`). ### Verification (Red -> Green) Hardware / OS: native Windows 11 Pro (`10.0.26200`) + **AMD Radeon RX 7900 XTX** (`gfx1100`, driver `32.0.32029.2010`), pinned toolchain `rustc 1.98.1`. - Rebased cleanly onto `main` (`40e7fe69d`). - `cargo clippy -p leonida-gpu --no-deps --all-targets -- -D warnings` — **0 warnings / PASS** (`17.89s`). - `cargo test -p leonida-gpu --lib -- --test-threads=4` — **`550 passed; 0 failed; 47 ignored`** (`12.69s`). - `python -I scripts/check_no_game_data.py` on all touched files — **PASS**. AI-assisted: Antigravity (Gemini 4 Neon)
Kal0s-design commented 2026-11-30 13:01:18 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Kal0s-design on 2026-11-30T13:01:18Z.


Independent Windows check of 667173c86 on current main f9f3ec4c6 (merges without conflict, 0b5db047e). Native Windows 11, MSVC x64, Rust 1.98.1.

  • cargo clippy -p leonida-gpu --no-deps --all-targets -- -D warnings: main exit 101 (41 errors in the lib, 49 in the lib tests); this PR exit 0. main has moved since the PR's base and gained no new lint this PR misses.
  • cargo test -p leonida-gpu --lib: 563 passed, 52 ignored, 0 failed on both main and the merge.
  • With #2681 (913e68b48) merged on top as well (a18b72f93), cargo clippy --workspace --all-targets -- -D warnings exits 0 for the whole d3d12/ workspace, as the description says the pair should.

GPUs tested: n/a (lints and CPU-side tests). AI-assisted: yes.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7279244779 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2682#issuecomment-7279244779). Originally posted by [Kal0s-design](https://github.com/Kal0s-design) on 2026-11-30T13:01:18Z. --- **Independent Windows check** of `667173c86` on current `main` `f9f3ec4c6` (merges without conflict, `0b5db047e`). Native Windows 11, MSVC x64, Rust 1.98.1. - `cargo clippy -p leonida-gpu --no-deps --all-targets -- -D warnings`: `main` exit 101 (41 errors in the lib, 49 in the lib tests); this PR exit 0. `main` has moved since the PR's base and gained no new lint this PR misses. - `cargo test -p leonida-gpu --lib`: 563 passed, 52 ignored, 0 failed on both `main` and the merge. - With #2681 (`913e68b48`) merged on top as well (`a18b72f93`), `cargo clippy --workspace --all-targets -- -D warnings` exits 0 for the whole `d3d12/` workspace, as the description says the pair should. GPUs tested: n/a (lints and CPU-side tests). AI-assisted: yes.
KelboLive commented 2026-11-30 15:54:05 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by KelboLive on 2026-11-30T15:54:05Z.


Independent check on Windows (not the author), at 667173c86.

  • cargo clippy --locked -p leonida-gpu --all-targets --no-deps -- -D warnings: clean, exit 0.
  • The broader cargo clippy -p leonida-gpu --all-targets -- -D warnings (without --no-deps) fails only while compiling the leonida-shader dependency, which still has 2 warnings at this head (unused_mut and one more). That is #2681's scope, not a leonida-gpu warning.

So the PR's own 52 warnings are fixed on this toolchain (Rust 1.98.1, Windows 11 26200.9711). To make the -D warnings CI form pass, it needs #2681 (or an allowed dependency-warning setting) as well.

AI-assisted: yes (opencode).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7283786529 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2682#issuecomment-7283786529). Originally posted by [KelboLive](https://github.com/KelboLive) on 2026-11-30T15:54:05Z. --- Independent check on Windows (not the author), at `667173c86`. - `cargo clippy --locked -p leonida-gpu --all-targets --no-deps -- -D warnings`: **clean, exit 0**. - The broader `cargo clippy -p leonida-gpu --all-targets -- -D warnings` (without `--no-deps`) fails only while compiling the `leonida-shader` dependency, which still has 2 warnings at this head (`unused_mut` and one more). That is #2681's scope, not a `leonida-gpu` warning. So the PR's own 52 warnings are fixed on this toolchain (Rust 1.98.1, Windows 11 26200.9711). To make the `-D warnings` CI form pass, it needs #2681 (or an allowed dependency-warning setting) as well. AI-assisted: yes (opencode).
merzleckeier commented 2026-11-30 16:41:44 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-11-30T16:41:44Z.


Full-workspace Clippy on the current merge base

MEASURED. I merged the exact heads 913e68b48 (#2681) and 667173c86 (#2682), separately and together, onto main 08e42a516. Rust 1.98.1 on Linux, MSVC x64 target. From d3d12/:

cargo xwin clippy --workspace --all-targets --locked --offline --jobs 8 \
  --target x86_64-pc-windows-msvc -- -D warnings
Tree Result
main Exit 101 (leonida-gpu lints, including clippy::int_plus_one)
main + #2681 Exit 101 (leonida-gpu lints)
main + #2682 Exit 101 (non-GPU lints, including clippy::manual_is_multiple_of in leonida-hle)
main + #2681 + #2682, in that order (0f8b8fa75) Exit 0, no diagnostics

The full-workspace -D warnings invocation is green after both land. This was a cross-target lint check. No game files, runtime tests or GPU runs were involved. AI-assisted: Codex (GPT-6.2 Sol).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7285082464 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2682#issuecomment-7285082464). Originally posted by [merzleckeier](https://github.com/merzleckeier) on 2026-11-30T16:41:44Z. --- ### Full-workspace Clippy on the current merge base **MEASURED.** I merged the exact heads `913e68b48` (#2681) and `667173c86` (#2682), separately and together, onto `main` `08e42a516`. Rust 1.98.1 on Linux, MSVC x64 target. From `d3d12/`: ```sh cargo xwin clippy --workspace --all-targets --locked --offline --jobs 8 \ --target x86_64-pc-windows-msvc -- -D warnings ``` | Tree | Result | | --- | --- | | `main` | Exit 101 (`leonida-gpu` lints, including `clippy::int_plus_one`) | | `main` + #2681 | Exit 101 (`leonida-gpu` lints) | | `main` + #2682 | Exit 101 (non-GPU lints, including `clippy::manual_is_multiple_of` in `leonida-hle`) | | `main` + #2681 + #2682, in that order (`0f8b8fa75`) | Exit 0, no diagnostics | The full-workspace `-D warnings` invocation is green after both land. This was a cross-target lint check. No game files, runtime tests or GPU runs were involved. AI-assisted: Codex (GPT-6.2 Sol).
bobcatchris commented 2026-11-30 23:20:59 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by bobcatchris on 2026-11-30T23:20:59Z.


Merged current main (d4fabd3fe) into this branch (a merge, no rebase or force-push); the new head is 66353598b. The earlier checks on 667173c86 were against the previous base, so they need repeating on this head.

What the merge changed beyond taking main:

  • One conflict, in leonida-gpu/src/host.rs: main added mod cross; where this branch has the cfg on indirects. Both kept.
  • main's new host/cross.rs has two sort_by calls that clippy asks to be sort_by_key (cross.rs:149 and the test at :288). Both are now sort_by_key(|w| std::cmp::Reverse(w.3)), a stable descending sort, so ties keep the order they had.

Run on the new head, Windows 11, Rust 1.98.1: cargo clippy --locked -p leonida-gpu --no-deps --all-targets -- -D warnings is clean (it reported those two errors before the fix); cargo test -p leonida-gpu --lib -- host::cross: 2 passed, 0 failed. I did not rerun the whole leonida-gpu suite on this head.

AI-assisted: Claude Sonnet 5.5

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7295012084 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2682#issuecomment-7295012084). Originally posted by [bobcatchris](https://github.com/bobcatchris) on 2026-11-30T23:20:59Z. --- Merged current `main` (`d4fabd3fe`) into this branch (a merge, no rebase or force-push); the new head is `66353598b`. The earlier checks on `667173c86` were against the previous base, so they need repeating on this head. What the merge changed beyond taking `main`: - One conflict, in `leonida-gpu/src/host.rs`: `main` added `mod cross;` where this branch has the `cfg` on `indirects`. Both kept. - `main`'s new `host/cross.rs` has two `sort_by` calls that clippy asks to be `sort_by_key` (`cross.rs:149` and the test at `:288`). Both are now `sort_by_key(|w| std::cmp::Reverse(w.3))`, a stable descending sort, so ties keep the order they had. Run on the new head, Windows 11, Rust 1.98.1: `cargo clippy --locked -p leonida-gpu --no-deps --all-targets -- -D warnings` is clean (it reported those two errors before the fix); `cargo test -p leonida-gpu --lib -- host::cross`: 2 passed, 0 failed. I did not rerun the whole `leonida-gpu` suite on this head. AI-assisted: Claude Sonnet 5.5
aslan2142 commented 2026-12-01 10:38:28 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-12-01T10:38:28Z.

Review: APPROVED


Reviewed all 27 touched files line-by-line (including the latest main merge covering host/cross.rs): clean, idiomatic Clippy fixes across leonida-gpu with zero #[allow] suppressions, dead alias_drain removal verified unused, and #[cfg(...)] gating for test/diagnostics-only items matches their callers. Independently verified on Rust 1.98.1 alongside #2681 for a clean workspace cargo clippy --all-targets -- -D warnings, clean-room verified, and all CI checks are green. Merging.

(AI-assisted review.)

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6129576509 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2682#pullrequestreview-6129576509). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-12-01T10:38:28Z. **Review:** APPROVED --- Reviewed all 27 touched files line-by-line (including the latest `main` merge covering `host/cross.rs`): clean, idiomatic Clippy fixes across `leonida-gpu` with zero `#[allow]` suppressions, dead `alias_drain` removal verified unused, and `#[cfg(...)]` gating for test/diagnostics-only items matches their callers. Independently verified on Rust 1.98.1 alongside #2681 for a clean workspace `cargo clippy --all-targets -- -D warnings`, clean-room verified, and all CI checks are green. Merging. *(AI-assisted review.)*
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
ProjectLeonida/mandy!2682
No description provided.