jouleclaw-loader-gguf: 161 clippy warnings -> 0, and -D warnings now gates it #414
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/loader-gguf-lints"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
#373 gated
jouleclaw-omni --features metalwith-D warningsbut left the crate omni loads its weights through linted by nothing at all. This closes it: 161 → 0, in both the default andrayon fabric-meterconfigurations, and loader-gguf joins the lint step instandards-build.yml.How
clippy --fix(MachineApplicable only)lib.rsMost of this crate's lints carry MaybeIncorrect suggestions, which
--fixskips. Those are still exact byte spans with exact replacement text — "maybe incorrect" means clippy will not promise the semantics, not that the text is wrong. So a small script applied them and the crate's 343 tests decided. That covered ~140 spans across 26 files.The policy allows are the same three decisions omni already records, for the same reasons, this being quantisation and tokeniser code with the same shapes:
needless_range_loop,too_many_arguments, and the two doc-indentation lints.The last dozen, which needed judgement
from_strmethods that are notFromStr-shaped (one returnsOption, one is infallible) renamed toparseassert!(FLASH_KV_CHUNK.is_power_of_two())and>= 64moved from a#[test]intoconst _: () = assert!(..)beside the constant — they are properties of a constant, and a test only holds them if someone runs itkv_quant_testsmoved to the end ofkv_cache_inplace.rs, which had 300 lines of real items after itResultfrommatmul_bf16_threaded, so a failure would have been timed as a successneedless_range_loopallowed per-file in three benches and one test, since those are separate crates andsrc/lib.rs's decision does not reach themFour things the work corrected about itself
needless_range_loopsuggestions are templates, not replacements. Clippy emitsfor (i, <item>) in w.iter_mut().enumerate(), leaving both the binding name and the body'sw[i]uses for a human. Applied literally it writes<item>into the source; four files stopped compiling. The applier now refuses any replacement containing a bare bracketed word — but the first version of that guard rejected all 28as_chunks::<2>()suggestions too, because a turbofish also has angle brackets.chunks_exact_mutsuggestsas_chunks_mut::<N>().0.iter()— a non-mutable iterator over a mutable chunk, which does not compile. Only thefabric-meterconfiguration contained one, so the default build stayed green while that example was broken. Checking both configurations caught it.mlx.rs, which reachesSafetensorsDtypethrough a type alias, soSafetensorsDtype::from_str(never matched.fabric_dispatch.rscallsledger_recordtwice with identical arguments; the comment three lines above says attention is "recorded as two GEMM-equivalents" so the measured µJ/GFLOP table prices it. Deliberate, left alone.Scope of the gate
Default features only. Under
rayon fabric-meterthis crate is also clean, but clippy reports jouleclaw-backend-apple through the path dependency (--no-depsdoes not exclude workspace members), and that crate has 43 warnings — 27unused_unsafeand 15unused_importsthat are unused in that configuration and needed in others. Those want cfg work rather than deletion, which is the trap #373 already paid for once, so they are left as their own change.Verified
All four lint specs in the step pass, 343 loader-gguf tests, 77 omni tests, both configurations build clean.
🤖 Generated with Claude Code
`cargo clippy --fix` only applies MachineApplicable suggestions, and most of this crate's remaining lints carry MaybeIncorrect ones. Those are still exact byte spans with exact replacement text; "maybe incorrect" means clippy will not promise the semantics, not that the text is wrong. So scripts/../apply-suggestions.py reads the JSON and applies them, and the crate's 343 tests decide. 96 spans across 26 files: collapsible_if, redundant_guards, needless_late_init, unnecessary_cast, manual_is_multiple_of, manual_repeat_n, unnecessary_sort_by, manual_slice_size_calculation, unused_mut, needless_lifetimes, needless_borrows_for_generic_args, double_parens. One suggestion class must never be applied this way, and it cost a revert to learn: `needless_range_loop` emits a *template*, not a replacement -- for (i, <item>) in w.iter_mut().enumerate().take(total) -- leaving both the binding name and the body's `w[i]` uses for a human. Applied literally it writes `<item>` into the source, which does not parse; four files failed to compile. They were reverted to HEAD and the applier now refuses any replacement containing `<` and `>`. The lesson that actually matters is the ordering: the first batch of 69 was verified green and then left uncommitted while a riskier batch ran on top, so reverting the breakage could not be done without also losing verified work. Commit verified progress before the next batch. Verified: 0 errors, 343 tests pass. Co-Authored-By: Claude Opus 5 <[email protected]>jouleclaw-loader-gguf: 161 -> 81 clippy warnings, and what the -D warnings gate still needsto jouleclaw-loader-gguf: 161 clippy warnings -> 0, and -D warnings now gates it