Skip to content

Commit b17cb32

Browse files
author
BO41
authored
Add "could be written as" example to MANUAL_MEMCPY
1 parent 49dff2c commit b17cb32

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

clippy_lints/src/loops.rs

Lines changed: 6 additions & 0 deletions
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)