-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #11778 - granddaifuku:fix/reduce-indexing-manual_memcpy…
…-when-array-length-is-equal-to-range, r=blyxyas fix: [manual_memcpy] reduce indexing suggestions when array length is equal to loop range fixes: #11689 This PR improves `manual_memcpy` suggestions by reducing unnecessary indexing. For example, ```rust let src = [0, 1, 2, 3, 4]; let mut dest = [0; 4]; for i in 0..4 { dest[i] = src[i]; { ``` Clippy suggests `dest[..4].copy_from_slice(&src[..4]);`. I reduced this suggestion as `dest.copy_from_slice(&src[..4]);`. (Removed needless indexing.) changelog: [`manual_memcpy`]: Reduce indexing suggestions when array length is equal to loop range
- Loading branch information
Showing
3 changed files
with
90 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters