Skip to content

Commit 6668e62

Browse files
committed
Auto merge of #4404 - BO41:patch-1, r=flip1995
Add "could be written as" example to MANUAL_MEMCPY <!-- Thank you for making Clippy better! We're collecting our changelog from pull request descriptions. If your PR only updates to the latest nightly, you can leave the `changelog` entry as `none`. Otherwise, please write a short comment explaining your change. If your PR fixes an issue, you can add "fixes #issue_number" into this PR description. This way the issue will be automatically closed when your PR is merged. If you added a new lint, here's a checklist for things that will be checked during review or continuous integration. - [ ] Followed [lint naming conventions][lint_naming] - [ ] Added passing UI tests (including committed `.stderr` file) - [ ] `cargo test` passes locally - [ ] Executed `./util/dev update_lints` - [ ] Added lint documentation - [ ] Run `./util/dev fmt` [lint_naming]: https://rust-lang.github.io/rfcs/0344-conventions-galore.html#lints Note that you can skip the above if you are just opening a WIP PR in order to get feedback. Delete this line and everything above before opening your PR --> changelog: none
2 parents b233685 + b17cb32 commit 6668e62

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

clippy_lints/src/loops.rs

+6
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,12 @@ declare_clippy_lint! {
4848
/// dst[i + 64] = src[i];
4949
/// }
5050
/// ```
51+
/// Could be written as:
52+
/// ```rust
53+
/// # let src = vec![1];
54+
/// # let mut dst = vec![0; 65];
55+
/// dst[64..(src.len() + 64)].clone_from_slice(&src[..]);
56+
/// ```
5157
pub MANUAL_MEMCPY,
5258
perf,
5359
"manually copying items between slices"

0 commit comments

Comments
 (0)