Add lint to suggest as_chunks over chunks_exact with constant
Adds a new lint chunks_exact_to_as_chunks that suggests using as_chunks instead of chunks_exact when the chunk size is a compile-time constant.
changelog: [chunks_exact_to_as_chunks]: Suggest using slice.as_chunks::<N>() when chunks_exact(N) is called with a compile-time constant. This provides better ergonomics and type safety.
fixes rust-lang/rust-clippy#15882
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
:warning: Warning :warning:
- There are issue links (such as
#123) in the commit messages of the following commits. Please move them to the PR description, to avoid spamming the issues with references to the commit, and so this bot can automatically canonicalize them to avoid issues with subtree.- 210a439be81b6caea318985099a57ac6a028f640
Lintcheck changes for 219eca31fb19ef3e0f718b303b5074ad45413019
| Lint | Added | Removed | Changed |
|---|---|---|---|
clippy::chunks_exact_with_const_size |
9 | 0 | 0 |
This comment will be updated if you push new changes
This PR was rebased onto a different master commit. Here's a range-diff highlighting what actually changed.
Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.
:warning: Warning :warning:
- There are issue links (such as
#123) in the commit messages of the following commits. Please move them to the PR description, to avoid spamming the issues with references to the commit, and so this bot can automatically canonicalize them to avoid issues with subtree.- 3d3d2bef1058f547623cf7894b9ec11dc2f9b129
FCP started: https://rust-lang.zulipchat.com/#narrow/channel/257328-clippy/topic/FCP.3A.20.60chunks_exact_with_const_size.60/with/556737670
Reminder, once the PR becomes ready for a review, use @rustbot ready.