Skip to content

🐛 Unbreak CI on the current stable Rust - #32

Merged
ManupaKDU merged 1 commit into
masterfrom
fix/clippy-chunks-exact-lint
Aug 27, 2026
Merged

🐛 Unbreak CI on the current stable Rust#32
ManupaKDU merged 1 commit into
masterfrom
fix/clippy-chunks-exact-lint

Conversation

@manupawickramasinghe

@manupawickramasinghe manupawickramasinghe commented Aug 26, 2026

Copy link
Copy Markdown
Member

Merge order: #32 (unbreaks currently-red CI) → #28#29#30#31. Each is independently reviewable; the order just keeps the checks readable.

Merge this one first. master's CI is red on Windows and macOS right now, which makes every other PR's checks hard to read.

What broke

Nothing in this project. Rust 1.98 added clippy::chunks_exact_to_as_chunks, and CI runs dtolnay/rust-toolchain@stable with -D warnings — so a lint introduced by a toolchain release fails the build with nothing having been pushed.

error: using `chunks_exact` with a constant chunk size
   --> src\source\firmware.rs:190:17
    | help: consider using `as_chunks` instead: `as_chunks::<4>().0.iter()`
    = note: `-D clippy::chunks-exact-to-as-chunks` implied by `-D warnings`

Two sites, one per platform — which is exactly why the Linux leg stayed green, since neither compiles there:

Site Platform
src/source/firmware.rs:190buf.chunks_exact(4) Windows (ACPI table enumeration)
src/source/macos/dvfs.rs:80bytes.chunks_exact(8) macOS (pmgr voltage states)

The fix

Both use as_chunks::<N>(), the replacement the lint itself suggests. Semantics are identical — the trailing partial chunk is dropped either way. The firmware site gets slightly simpler on the way, since as_chunks yields &[u8; 4] and the signature converts without re-indexing:

buf.as_chunks::<4>().0.iter().map(|c| u32::from_ne_bytes(*c))

The MSRV floor does not move. slice::as_chunks has been stable since Rust 1.88; this crate declares rust-version = "1.95".

Verification

  • cargo clippy --all-targets -- -D warnings -D clippy::await_holding_lock — exit 0 on Windows.
  • Full test suite: 83 passed, 0 failed.
  • The macOS site cannot be compiled on this machine, so its expression was type-checked standalone and asserted to drop a trailing partial pair exactly as chunks_exact did (2 whole pairs from 19 bytes, remainder dropped). The macOS leg of CI is what actually proves it.

One thing worth recording: local clippy could not reproduce this at all. This machine is on rustc 1.97.1 and the lint arrived in 1.98 — so the failure was only visible from the CI logs, not from a local run.

Worth considering separately

This will recur. -D warnings against a floating stable toolchain means any future clippy release can turn CI red without a commit. Options are pinning the toolchain, or splitting the lint gate into a non-blocking job — a policy call rather than something to decide inside a fix.

🤖 Generated with Claude Code

The Windows and macOS legs have been failing on master. Neither is a change in
this project: Rust 1.98 added `clippy::chunks_exact_to_as_chunks`, and CI runs
`dtolnay/rust-toolchain@stable` with `-D warnings`, so a new lint in a toolchain
release fails the build with nothing having been pushed.

Two sites, one per platform, which is why the Linux leg stayed green — neither
compiles there:

  src/source/firmware.rs:190      buf.chunks_exact(4)   (Windows, ACPI)
  src/source/macos/dvfs.rs:80     bytes.chunks_exact(8) (macOS, pmgr states)

Both now use `as_chunks::<N>()`, the replacement the lint itself suggests.
Semantics are identical — the trailing partial chunk is dropped either way —
and the firmware one gets slightly simpler on the way, since `as_chunks` yields
`&[u8; 4]` and the signature converts without re-indexing.

`slice::as_chunks` has been stable since Rust 1.88, well below this crate's
declared `rust-version = "1.95"`, so the floor does not move.

Verified with `cargo clippy --all-targets -- -D warnings` and the full test
suite on Windows. The macOS site cannot be compiled here, so its expression was
type-checked standalone and asserted to drop a trailing partial pair exactly as
`chunks_exact` did — but the macOS leg of CI is what actually proves it.

Note that local clippy could not reproduce this at all: this machine is on
1.97.1 and the lint arrived in 1.98.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Copilot AI lite review requested due to automatic review settings August 26, 2026 22:04

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants