Add "could be written as" example to MANUAL_MEMCPY

This commit is contained in:
BO41 2019-08-17 13:09:03 +00:00 committed by GitHub
parent 49dff2c9f3
commit b17cb32bcb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -48,6 +48,12 @@ declare_clippy_lint! {
/// dst[i + 64] = src[i];
/// }
/// ```
/// Could be written as:
/// ```rust
/// # let src = vec![1];
/// # let mut dst = vec![0; 65];
/// dst[64..(src.len() + 64)].clone_from_slice(&src[..]);
/// ```
pub MANUAL_MEMCPY,
perf,
"manually copying items between slices"