chore: silence clippy 1.95 lint regressions across workspace#18
Merged
Conversation
Rust 1.95.0 promoted several lints to default-warn (and CI runs with
`-D warnings`), causing a cascade of build failures across mlxcel-core
and mlxcel-surgery that had nothing to do with their underlying logic.
This commit makes the workspace lint-clean again under the new toolchain.
Auto-fixed via `cargo clippy --fix`:
- `manual_is_multiple_of` → `.is_multiple_of()` (pack3, quant3, utils)
- `manual_div_ceil` → `.div_ceil()` (utils)
- `unnecessary_cast` (quant, codebook, generate, etc.)
- `useless_conversion` (generate)
- `double_parens` (mtp/tests)
Manually rewritten:
- `needless_range_loop` → iterator + take/enumerate where the conversion
was clear (utils, quant, quant3, sampling, boundary, turbo_tests).
- `field_reassign_with_default` → struct-init form (generate, speculative).
- `doc_overindented_list_items` → list-continuation indent normalised
(speculative/mtp/generator).
- `doc_lazy_continuation` → reworded the `softmax + cold-V` paragraph in
turbo_tests so a leading `+` no longer parses as a markdown list marker.
- `unusual_byte_groupings` → `0xC0FF_EE42` (pack3, quant).
- `duplicated_attribute` → drop inner `#![cfg(test)]` where the parent
module already gates with `#[cfg(test)]` (mlxcel-surgery).
- Added a `# Safety` section to `attention_from_ptr` (layers).
Targeted `#[allow(...)]` (intentional shape, not worth restructuring):
- `too_many_arguments` on the attention-dispatch helpers in `layers.rs`
and the `attention_sparse_v_turbo4{,_fused}` kernels: positional
signatures intentionally mirror Metal/MLX call sites.
- `needless_range_loop` on `forward_batched`: mixed indexing into
`input_ids` slices and `batch_caches[i]` is clearer than enumerate.
- `large_enum_variant` / `result_large_err` on the paged-cache adopt
path: shrinking the variant would force callers through `Box` for no
runtime gain on a cold path.
- `type_complexity` on the `SyntheticTarget` test fixture's
`rollback_events`: it is a one-off test type.
`cargo clippy --workspace --all-targets -- -D warnings` is clean and
`cargo test --workspace` matches the pre-existing baseline (the same two
`multimodal::video` fd-variant tests fail on `main` too, due to runtime
ffmpeg policy mismatches unrelated to this change).
The earlier sweep ran without `--features metal,accelerate`, so the CI build (which uses that exact feature set) still tripped on two finds: - `quant.rs:422` unnecessary `as usize` cast on an already-usize index - `generate.rs:826` explicit `.into_iter()` inside `zip(...)` which already accepts any `IntoIterator` `cargo clippy --workspace --all-targets --features metal,accelerate -- -D warnings` is now clean.
server::batch::speculative_burst::zip already accepts IntoIterator, so the explicit `.into_iter()` on rows_tokens is redundant. Missed in the prior sweep because the local check ran against a cached clippy result where this file was unchanged; `cargo clean` followed by a fresh `cargo clippy --workspace --all-targets --features metal,accelerate -- -D warnings` confirms the workspace is now clean.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Rust 1.95.0 promoted several clippy lints to default-warn, and our CI runs
cargo clippy -- -D warningson a self-hosted macOS runner. The result was that PR #17 (and any other unrelated PR) couldn't pass CI: 53 lint findings (25 errors in CI's stricter view) lit up acrossmlxcel-coreandmlxcel-surgerydespite no behavioural change.This PR clears every one of them. The workspace is now lint-clean under
-D warningsagainst rust 1.95.0.What changed
Auto-fixed via
cargo clippy --fix(8 files, 18 changes):manual_is_multiple_of,manual_div_ceil,unnecessary_cast,useless_conversion,double_parens.Manually rewritten:
needless_range_loop→ iterator +take/enumerate(utils, quant, quant3, sampling, boundary, turbo_tests).field_reassign_with_default→ struct-init form (generate, speculative).doc_overindented_list_items→ list-continuation indent normalised (mtp/generator).doc_lazy_continuation→ reworded asoftmax + cold-Vline so leading+no longer parses as a markdown list marker.unusual_byte_groupings→0xC0FF_EE42(pack3, quant).duplicated_attribute→ drop inner#![cfg(test)]where the parent already gates with#[cfg(test)].missing_safety_doc→ added# Safetytoattention_from_ptr.Targeted
#[allow(...)](intentional shape, not worth restructuring):too_many_argumentson attention-dispatch helpers inlayers.rsand theattention_sparse_v_turbo4{,_fused}kernels — positional signatures intentionally mirror Metal/MLX call sites.needless_range_looponforward_batched— mixed indexing intoinput_idsslices andbatch_caches[i]is clearer than enumerate.large_enum_variant/result_large_erron the paged-cache adopt path — shrinking forces callers throughBoxfor no runtime gain on a cold path.type_complexityon theSyntheticTargettest fixture'srollback_events— one-off test type.Verification
cargo clippy --workspace --all-targets -- -D warnings— cleancargo fmt --all -- --check— cleancargo test --workspace— 2757 passed; matches the pre-existing baseline onmain(samemultimodal::video::tests::load_video_source_fd_variant_*failures occur onmaintoo, due to ffmpeg policy mismatches unrelated to this change)Why a separate PR
PR #17 (gpt-oss perf fix) cannot pass CI until main is lint-clean. Bundling the two would mix an architectural perf fix with mechanical lint janitorial work. This PR lands first; #17 will rebase onto the cleaned-up main and re-trigger CI.