Skip to content

chore: read USB MIDI packets with as_chunks to satisfy clippy - #643

Open
kosmar wants to merge 1 commit into
ATOVproject:mainfrom
kosmar:chore/clippy-as-chunks
Open

chore: read USB MIDI packets with as_chunks to satisfy clippy#643
kosmar wants to merge 1 commit into
ATOVproject:mainfrom
kosmar:chore/clippy-as-chunks

Conversation

@kosmar

@kosmar kosmar commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

clippy::chunks_exact_to_as_chunks fires on the constant chunk size in the USB
RX loop of tasks/midi.rs. CI runs clippy with -D warnings, so on a current
toolchain main does not pass its own gate — and several open feature branches
have been carrying this exact one-line fix inside unrelated app commits just to
stay green.

as_chunks::<4>() yields &[[u8; 4]], so the packet indexing below is
unchanged. Discarding the remainder matches the previous behaviour: chunks_exact
dropped a trailing partial packet as well, and a USB MIDI bulk transfer is always
a multiple of four bytes.

Verified with cargo clippy --bin faderpunk --target thumbv8m.main-none-eabihf -- -D warnings,
which is clean on this branch and fails on main.

Authored by an AI coding agent on behalf of @kosmar.

Made with Cursor

clippy::chunks_exact_to_as_chunks fires on the constant chunk size in the USB RX
loop, and CI runs clippy with -D warnings, so main does not pass its own gate on
a current toolchain. Feature branches have been carrying this same one-line fix
inside unrelated app commits to stay green; landing it here means they no longer
have to.

as_chunks::<4>() yields &[[u8; 4]], so the packet indexing below is unchanged.
The discarded remainder matches the previous behaviour: chunks_exact dropped a
trailing partial packet too, and a USB MIDI bulk transfer is always a multiple
of four bytes.

Authored by an AI coding agent on behalf of kosmar.

Co-authored-by: Cursor <cursoragent@cursor.com>
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.

2 participants