mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-12-21 02:23:19 +00:00
123 lines
3.8 KiB
Text
123 lines
3.8 KiB
Text
error: it looks like you're manually copying between slices
|
|
--> $DIR/with_loop_counters.rs:5:5
|
|
|
|
|
LL | / for i in 3..src.len() {
|
|
LL | |
|
|
LL | |
|
|
LL | | dst[i] = src[count];
|
|
LL | | count += 1;
|
|
LL | | }
|
|
| |_____^ help: try replacing the loop by: `dst[3..src.len()].copy_from_slice(&src[..(src.len() - 3)]);`
|
|
|
|
|
= note: `-D clippy::manual-memcpy` implied by `-D warnings`
|
|
|
|
error: it looks like you're manually copying between slices
|
|
--> $DIR/with_loop_counters.rs:13:5
|
|
|
|
|
LL | / for i in 3..src.len() {
|
|
LL | |
|
|
LL | | dst[count] = src[i];
|
|
LL | | count += 1;
|
|
LL | | }
|
|
| |_____^ help: try replacing the loop by: `dst[..(src.len() - 3)].copy_from_slice(&src[3..]);`
|
|
|
|
error: it looks like you're manually copying between slices
|
|
--> $DIR/with_loop_counters.rs:20:5
|
|
|
|
|
LL | / for i in 0..src.len() {
|
|
LL | |
|
|
LL | | dst[count] = src[i];
|
|
LL | | count += 1;
|
|
LL | | }
|
|
| |_____^ help: try replacing the loop by: `dst[3..(src.len() + 3)].copy_from_slice(&src[..]);`
|
|
|
|
error: it looks like you're manually copying between slices
|
|
--> $DIR/with_loop_counters.rs:27:5
|
|
|
|
|
LL | / for i in 0..src.len() {
|
|
LL | |
|
|
LL | | dst[i] = src[count];
|
|
LL | | count += 1;
|
|
LL | | }
|
|
| |_____^ help: try replacing the loop by: `dst[..src.len()].copy_from_slice(&src[3..(src.len() + 3)]);`
|
|
|
|
error: it looks like you're manually copying between slices
|
|
--> $DIR/with_loop_counters.rs:34:5
|
|
|
|
|
LL | / for i in 3..(3 + src.len()) {
|
|
LL | |
|
|
LL | | dst[i] = src[count];
|
|
LL | | count += 1;
|
|
LL | | }
|
|
| |_____^ help: try replacing the loop by: `dst[3..(3 + src.len())].copy_from_slice(&src[..(3 + src.len() - 3)]);`
|
|
|
|
error: it looks like you're manually copying between slices
|
|
--> $DIR/with_loop_counters.rs:41:5
|
|
|
|
|
LL | / for i in 5..src.len() {
|
|
LL | |
|
|
LL | | dst[i] = src[count - 2];
|
|
LL | | count += 1;
|
|
LL | | }
|
|
| |_____^ help: try replacing the loop by: `dst[5..src.len()].copy_from_slice(&src[(3 - 2)..((src.len() - 2) + 3 - 5)]);`
|
|
|
|
error: it looks like you're manually copying between slices
|
|
--> $DIR/with_loop_counters.rs:48:5
|
|
|
|
|
LL | / for i in 0..dst.len() {
|
|
LL | |
|
|
LL | | dst[i] = src[count];
|
|
LL | | count += 1;
|
|
LL | | }
|
|
| |_____^ help: try replacing the loop by: `dst.copy_from_slice(&src[2..(dst.len() + 2)]);`
|
|
|
|
error: it looks like you're manually copying between slices
|
|
--> $DIR/with_loop_counters.rs:55:5
|
|
|
|
|
LL | / for i in 3..10 {
|
|
LL | |
|
|
LL | | dst[i] = src[count];
|
|
LL | | count += 1;
|
|
LL | | }
|
|
| |_____^ help: try replacing the loop by: `dst[3..10].copy_from_slice(&src[5..(10 + 5 - 3)]);`
|
|
|
|
error: it looks like you're manually copying between slices
|
|
--> $DIR/with_loop_counters.rs:63:5
|
|
|
|
|
LL | / for i in 0..src.len() {
|
|
LL | |
|
|
LL | | dst[count] = src[i];
|
|
LL | | dst2[count2] = src[i];
|
|
LL | | count += 1;
|
|
LL | | count2 += 1;
|
|
LL | | }
|
|
| |_____^
|
|
|
|
|
help: try replacing the loop by
|
|
|
|
|
LL ~ dst[3..(src.len() + 3)].copy_from_slice(&src[..]);
|
|
LL + dst2[30..(src.len() + 30)].copy_from_slice(&src[..]);
|
|
|
|
|
|
|
error: it looks like you're manually copying between slices
|
|
--> $DIR/with_loop_counters.rs:74:5
|
|
|
|
|
LL | / for i in 0..1 << 1 {
|
|
LL | |
|
|
LL | | dst[count] = src[i + 2];
|
|
LL | | count += 1;
|
|
LL | | }
|
|
| |_____^ help: try replacing the loop by: `dst[(0 << 1)..((1 << 1) + (0 << 1))].copy_from_slice(&src[2..((1 << 1) + 2)]);`
|
|
|
|
error: it looks like you're manually copying between slices
|
|
--> $DIR/with_loop_counters.rs:82:5
|
|
|
|
|
LL | / for i in 3..src.len() {
|
|
LL | |
|
|
LL | | dst[i] = src[count];
|
|
LL | | count += 1
|
|
LL | | }
|
|
| |_____^ help: try replacing the loop by: `dst[3..src.len()].copy_from_slice(&src[..(src.len() - 3)]);`
|
|
|
|
error: aborting due to 11 previous errors
|
|
|