jouleclaw-backend-apple: 84 clippy warnings -> 0, and -D warnings now covers both configurations #437

Merged
dcharlot merged 2 commits from fix/backend-apple-lints into main 2026-11-01 07:42:04 -05:00
Owner

This closes the per-configuration lint hole #373 opened and #414 halved. The -D warnings step now lints jouleclaw-loader-gguf under rayon fabric-meter as well as on default, plus jouleclaw-backend-apple on its own.

Two things I had wrong in #414, both settled by measuring

#414's comment in standards-build.yml said the fabric-meter configuration could not be gated because backend-apple's warnings "are unused in THAT configuration and needed in others, so they want cfg work rather than deletion."

  • The crate has no [features] at all — only a macOS-conditional dependency block. There is one configuration, so the unused items are unconditionally unused.
  • It was 84 warnings, not 43. The 43 was what leaked through loader-gguf's lint, not the crate's own count. 82 of the 84 live in mps_matmul.rs.

How it came down

clippy's own suggestions 41 (manual_is_multiple_of 23, unnecessary_cast 8, needless_option_as_deref 3, …)
27 unused_unsafe + 15 unused_imports hand-fixed, line-guided
the last ten by hand

The middle group is the interesting one: neither clippy --fix nor cargo fix will touch them, with or without --all-targets. They carry no machine-applicable suggestion (suggested_replacement is None). They are plain code rather than macro expansions, so they were fixed from rustc's own line numbers:

  • || unsafe { .. } → || { .. } where objc2 0.6 made the call safe. Dropping a block rustc has already proved redundant cannot change behaviour.
  • use objc2_metal::{MTLComputePipelineState as _, MTLLibrary as _} → just the name the function needs. The unused one is a trait brought in as _; the type is referenced fully qualified two lines above, which is why it reads as used at a glance.

Checked before deleting, because this is exactly the shape that broke #372: each unused import was matched against every other mention of its name in the file and against the file's six cfg(not(target_os = "macos")) branches. None appears in one — and objc2-metal is a macOS-only dependency, so no other configuration could want them.

The last ten

  • struct PipelineCell with its unsafe impl Send/Sync was never constructed and mentioned nowhere else — scaffolding for a OnceLock wrapper the pipelines ended up doing directly. Removed, and the space reused for a KeepAlive type alias, which is what both type_complexity warnings wanted: the inline form is three generic layers deep and appeared twice.
  • DeviceKvCache had a public len and no is_empty.
  • three let qk_pipe = qk_pipe; no-op rebindings left from a refactor.
  • too_many_arguments and needless_range_loop allowed crate-wide — the same two decisions omni and loader-gguf already record, for the same reasons.

Verified

All ten lint specs in the step pass, 37 backend-apple tests (32 pass, 5 ignored), 343 loader-gguf tests, 77 omni tests.

🤖 Generated with Claude Code

This closes the per-configuration lint hole #373 opened and #414 halved. The `-D warnings` step now lints `jouleclaw-loader-gguf` under **`rayon fabric-meter`** as well as on default, plus `jouleclaw-backend-apple` on its own. ## Two things I had wrong in #414, both settled by measuring #414's comment in `standards-build.yml` said the fabric-meter configuration could not be gated because backend-apple's warnings "are unused in THAT configuration and needed in others, so they want cfg work rather than deletion." - **The crate has no `[features]` at all** — only a macOS-conditional *dependency* block. There is one configuration, so the unused items are unconditionally unused. - **It was 84 warnings, not 43.** The 43 was what leaked through loader-gguf's lint, not the crate's own count. 82 of the 84 live in `mps_matmul.rs`. ## How it came down | | | |---|---| | clippy's own suggestions | 41 (`manual_is_multiple_of` 23, `unnecessary_cast` 8, `needless_option_as_deref` 3, …) | | 27 `unused_unsafe` + 15 `unused_imports` | hand-fixed, line-guided | | the last ten | by hand | The middle group is the interesting one: **neither `clippy --fix` nor `cargo fix` will touch them**, with or without `--all-targets`. They carry no machine-applicable suggestion (`suggested_replacement` is `None`). They are plain code rather than macro expansions, so they were fixed from rustc's own line numbers: - `|| unsafe { .. }` → `|| { .. }` where objc2 0.6 made the call safe. Dropping a block rustc has already proved redundant cannot change behaviour. - `use objc2_metal::{MTLComputePipelineState as _, MTLLibrary as _}` → just the name the function needs. The unused one is a trait brought in as `_`; the *type* is referenced fully qualified two lines above, which is why it reads as used at a glance. **Checked before deleting**, because this is exactly the shape that broke #372: each unused import was matched against every other mention of its name in the file and against the file's six `cfg(not(target_os = "macos"))` branches. None appears in one — and `objc2-metal` is a macOS-only dependency, so no other configuration could want them. ## The last ten - `struct PipelineCell` with its `unsafe impl Send`/`Sync` was never constructed and mentioned nowhere else — scaffolding for a `OnceLock` wrapper the pipelines ended up doing directly. Removed, and the space reused for a `KeepAlive` type alias, which is what both `type_complexity` warnings wanted: the inline form is three generic layers deep and appeared twice. - `DeviceKvCache` had a public `len` and no `is_empty`. - three `let qk_pipe = qk_pipe;` no-op rebindings left from a refactor. - `too_many_arguments` and `needless_range_loop` allowed crate-wide — the same two decisions omni and loader-gguf already record, for the same reasons. ## Verified All **ten** lint specs in the step pass, 37 backend-apple tests (32 pass, 5 ignored), 343 loader-gguf tests, 77 omni tests. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
#414 left this crate as the reason the `-D warnings` gate covers
loader-gguf on default features only: clippy reports it through the path
dependency, so gating the `fabric-meter` configuration needs it clean too.

I described its warnings in #414 as "unused in THAT configuration and
needed in others, so they want cfg work rather than deletion". That was
wrong on two counts, and measuring it directly settled both:

- the crate has NO `[features]` at all, only a macOS-conditional
  dependency block, so there is one configuration and the unused items
  are unconditionally unused;
- there are 84 of them, not 43. The 43 was what leaked through
  loader-gguf's lint, not the crate's own count.

82 of the 84 are in mps_matmul.rs.

41 came from clippy's own suggestions (manual_is_multiple_of 23,
unnecessary_cast 8, needless_option_as_deref 3, excessive_precision,
doc_lazy_continuation, double_parens, chunks_exact_to_as_chunks).

The other 42 -- 27 `unused_unsafe` and 15 `unused_imports` -- carry no
machine-applicable suggestion at all. Neither `clippy --fix` nor
`cargo fix` touches them, with or without `--all-targets`. They are
plain code, not macro expansions, so they were fixed line-guided from
rustc's own line numbers:

- `|| unsafe { .. }` -> `|| { .. }` where objc2 0.6 made the call safe.
  Dropping a block rustc has already proved redundant cannot change
  behaviour.
- `use objc2_metal::{MTLComputePipelineState as _, MTLLibrary as _}` ->
  just the name the function needs. The unused one is a trait brought in
  as `_`; the type itself is referenced fully qualified on the lines
  above, which is why it reads as used at a glance.

Checked before deleting, because this is the shape that broke #372: each
unused import was matched against every other mention of the name in its
file and against the file's six `cfg(not(target_os = "macos"))` branches.
None appears in one, and objc2-metal is a macOS-only dependency, so no
other configuration can want them.

Verified: 0 errors, 37 backend-apple tests (32 pass, 5 ignored), and
loader-gguf still builds and its fabric-meter `process_calibration`
passes.

Co-Authored-By: Claude Opus 5 <[email protected]>
jouleclaw-backend-apple: 0 warnings, and the gate covers both configurations
All checks were successful
jouleclaw public surface must stay documented / Public-surface audit (jouleclaw-rs) (pull_request) Successful in 59s
standards workspaces build + test / which workspaces this change touches (pull_request) Successful in 5s
repository checks / lockfiles, tests in CI, workflow hygiene, spec and section references, public text (pull_request) Successful in 37s
standards workspaces build + test / jouleclaw-rs (-nodebug, jouleclaw/jouleclaw-rs, -p jouleclaw-energy --features rapl,nvml, jouleclaw-rs, linux-arm64, -C target-feature=+fp16) (pull_request) Successful in 3m18s
standards workspaces build + test / joulecontract-rs (joulecontract/joulecontract-rs, joulecontract-rs, linux-arm64, true) (pull_request) Successful in 1m11s
standards workspaces build + test / arl-rs (arl/arl-rs, arl-rs, linux) (pull_request) Successful in 1m13s
standards workspaces build + test / aac-rs (aac-conformance, aac/aac-rs, aac-rs, linux-arm64) (pull_request) Successful in 4m18s
standards workspaces build + test / map-rs (map-conformance, map/map-rs, map-rs, linux-arm64) (pull_request) Successful in 1m19s
standards workspaces build + test / eoc-rs (eoc/eoc-rs, -p eoc-meter --features cuda, eoc-rs, linux) (pull_request) Successful in 2m10s
standards workspaces build + test / jcp-rs (jcp-conformance, jcp/jcp-rs, -p jcp-energy --features nvml, jcp-rs, linux) (pull_request) Successful in 2m2s
standards workspaces build + test / mesh-rs (mesh/mesh-rs, -p mesh-engine-gguf -p mesh-openai --features mesh-engine-gguf/gguf,mesh-openai/server, mesh-rs, linux-arm64) (pull_request) Successful in 1m27s
standards workspaces build + test / joule-ui-rs (joule-ui/joule-ui-rs, joule-ui-rs, linux) (pull_request) Successful in 1m11s
standards workspaces build + test / joulehook-rs (joulehook/joulehook-rs, joulehook-rs, linux) (pull_request) Successful in 1m14s
standards workspaces build + test / joule-code-rs (joule-code/joule-code-rs, joule-code-rs, linux-arm64, true) (pull_request) Successful in 5m6s
standards workspaces build + test / pool-rs (pool/pool-rs, pool-rs, linux) (pull_request) Successful in 1m7s
standards workspaces build + test / proof-rs (proof-conformance, proof/proof-rs, proof-rs, linux, true) (pull_request) Successful in 1m50s
standards workspaces build + test / sense-rs (sense/sense-rs, sense-rs, linux) (pull_request) Successful in 1m11s
standards workspaces build + test / sandbox-rs (sandbox-conformance, sandbox/sandbox-rs, sandbox-rs, linux) (pull_request) Successful in 2m25s
standards workspaces build + test / openpay (openpay, openpay, linux-arm64) (pull_request) Successful in 8m30s
standards workspaces build + test / smart-byte-rs (smart-byte/smart-byte-rs, smart-byte-rs, linux) (pull_request) Successful in 4m27s
standards workspaces build + test / macOS energy backends (pull_request) Successful in 8m25s
standards workspaces build + test / jouledesk-rs (jouledesk/jouledesk-rs, jouledesk-rs, macos) (pull_request) Successful in 2m52s
19904251b7
10 -> 0, and the `-D warnings` step now lints loader-gguf under
`rayon fabric-meter` as well as on default, plus backend-apple on its
own. That closes the per-configuration lint hole #373 opened and #414
halved.

The last ten, all in mps_matmul.rs:

- `struct PipelineCell` with its `unsafe impl Send`/`Sync` was never
  constructed and mentioned nowhere else -- scaffolding for a OnceLock
  wrapper the pipelines ended up doing directly. Removed, and the space
  reused for a `KeepAlive` alias, which is what the two `type_complexity`
  warnings wanted: the inline form is three generic layers deep and
  appeared twice.
- `DeviceKvCache` had a public `len` and no `is_empty`.
- three `let qk_pipe = qk_pipe;` no-op rebindings from a refactor.
- `too_many_arguments` and `needless_range_loop` allowed crate-wide, the
  same two decisions omni and loader-gguf already record and for the same
  reasons: a GPU dispatch signature is its kernel's parameter list, and
  these kernels walk several buffers at one index.

The comment this replaces in standards-build.yml claimed the fabric-meter
configuration could not be gated because backend-apple's warnings "are
unused in THAT configuration and needed in others, so they want cfg work
rather than deletion". Measuring the crate directly refuted both halves:
it has no `[features]` at all, so there is one configuration, and the
count was 84 rather than the 43 that leaked through loader-gguf's lint.

Verified: all ten lint specs in the step pass, 37 backend-apple tests
(32 pass, 5 ignored), 343 loader-gguf tests, 77 omni tests.

Co-Authored-By: Claude Opus 5 <[email protected]>
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
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.

Dependencies

No dependencies set

Reference
Transaction-Science/open-standards!437
No description provided.