chore(lint): use as_chunks for constant-size slice chunking #322
No reviewers
Labels
No labels
area/ci-release
area/cli
area/docs
area/dungeon
area/ftl
area/graphics
area/gui
area/music
area/saves
area/tooling
port/amiga
port/dos
port/fm-towns
port/mac
port/pc98
port/sega-cd
priority/high
priority/low
priority/medium
type/bug
type/chore
type/docs
type/feature
type/research
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
jqueuniet/dm2-tools!322
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "chore/clippy-as-chunks"
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?
clippy 1.98 fires
chunks_exact_to_as_chunkson everychunks_exact(N)with aconstant
N— 19 sites across eight files in five crates.rust:1-trixie, theimage CI's
stablejob uses, ships 1.98.0 today, so this goes red as soon asthe runner pulls that tag again.
Not just cosmetic
as_chunksyields&[T; N]rather than&[T], so thetry_into().unwrap()/try_into().expect(...)pairs that turned each chunk back into an arraydisappear at five sites:
Behaviour is unchanged
as_chunksdrops a trailing partial chunk exactly aschunks_exactdoes.transcode_u16_arraywas the one site consumingchunks.remainder(); it nowtakes the remainder from the tuple's second element and still copies the odd
trailing byte through. The
impl ExactSizeIteratorin public signatures stillholds, since
slice::Iteris one.convert.rskeeps its remainingchunks_exact(size)— that one chunks by aruntime parameter, which
as_chunkscannot express and the lint does not flag.MSRV
as_chunksandas_chunks_mutare both stable since 1.88, under the 1.90floor. Verified by running
cargo +1.90 check --workspace --all-targets --lockedin the CI image, not just by reading the stability attributes.Checks
cargo fmt --check,cargo clippy --workspace --all-targets -D warnings(clean),
cargo test --workspace --locked(132 suites, 1249 passed, 0 failed),cargo docwith warnings denied.No CHANGELOG entry: this is an internal refactor with no user-visible effect,
and touching the
Unreleasedsection here would conflict with #321.