mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-27 15:11:30 +00:00
Add missing tests
This commit is contained in:
parent
51585a1298
commit
461f4a3466
2 changed files with 24 additions and 2 deletions
|
@ -99,6 +99,16 @@ pub fn manual_copy(src: &[i32], dst: &mut [i32], dst2: &mut [i32]) {
|
|||
dst[i] = src[i - from];
|
||||
}
|
||||
|
||||
#[allow(clippy::identity_op)]
|
||||
for i in 0..5 {
|
||||
dst[i - 0] = src[i];
|
||||
}
|
||||
|
||||
#[allow(clippy::reverse_range_loop)]
|
||||
for i in 0..0 {
|
||||
dst[i] = src[i];
|
||||
}
|
||||
|
||||
// `RangeTo` `for` loop - don't trigger lint
|
||||
for i in 0.. {
|
||||
dst[i] = src[i];
|
||||
|
|
|
@ -67,10 +67,22 @@ LL | for i in from..from + 3 {
|
|||
| ^^^^^^^^^^^^^^ help: try replacing the loop by: `dst[from..from + 3].clone_from_slice(&src[..(from + 3 - from)])`
|
||||
|
||||
error: it looks like you're manually copying between slices
|
||||
--> $DIR/manual_memcpy.rs:110:14
|
||||
--> $DIR/manual_memcpy.rs:103:14
|
||||
|
|
||||
LL | for i in 0..5 {
|
||||
| ^^^^ help: try replacing the loop by: `dst[..5].clone_from_slice(&src[..5])`
|
||||
|
||||
error: it looks like you're manually copying between slices
|
||||
--> $DIR/manual_memcpy.rs:108:14
|
||||
|
|
||||
LL | for i in 0..0 {
|
||||
| ^^^^ help: try replacing the loop by: `dst[..0].clone_from_slice(&src[..0])`
|
||||
|
||||
error: it looks like you're manually copying between slices
|
||||
--> $DIR/manual_memcpy.rs:120:14
|
||||
|
|
||||
LL | for i in 0..src.len() {
|
||||
| ^^^^^^^^^^^^ help: try replacing the loop by: `dst[..src.len()].clone_from_slice(&src[..])`
|
||||
|
||||
error: aborting due to 11 previous errors
|
||||
error: aborting due to 13 previous errors
|
||||
|
||||
|
|
Loading…
Reference in a new issue