Skip to content

Add lint to suggest as_chunks over chunks_exact with constant#16931

Open
mtotbagi wants to merge 3 commits intorust-lang:masterfrom
mtotbagi:as_chunks
Open

Add lint to suggest as_chunks over chunks_exact with constant#16931
mtotbagi wants to merge 3 commits intorust-lang:masterfrom
mtotbagi:as_chunks

Conversation

@mtotbagi
Copy link
Copy Markdown

@mtotbagi mtotbagi commented Apr 29, 2026

changelog: [chunks_exact_to_as_chunks]: Suggest using slice.as_chunks::() when chunks_exact(N) is called with a compile-time constant. This provides better ergonomics and type safety.

fixes #15882

Picked up where #16002 left off

rommeld and others added 3 commits April 29, 2026 16:27
This lint suggests using `as_chunks` or `as_chunks_mut` instead of
`chunks_exact` or `chunks_exact_mut` when called with a constant size.

changelog: new lint: [`chunks_exact_to_as_chunks`]
@rustbot rustbot added needs-fcp PRs that add, remove, or rename lints and need an FCP S-waiting-on-review Status: Awaiting review from the assignee but also interested parties labels Apr 29, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Apr 29, 2026

r? @Jarcho

rustbot has assigned @Jarcho.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: 7 candidates
  • 7 candidates expanded to 7 candidates
  • Random selection from Jarcho, dswij, llogiq

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

Labels

needs-fcp PRs that add, remove, or rename lints and need an FCP S-waiting-on-review Status: Awaiting review from the assignee but also interested parties

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Suggest as_chunks when people use chunks_exact with a constant length

4 participants