mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-12-22 11:03:16 +00:00
175 lines
5.8 KiB
Text
175 lines
5.8 KiB
Text
error: it looks like you're manually copying between slices
|
|
--> tests/ui/manual_memcpy/without_loop_counters.rs:9:5
|
|
|
|
|
LL | / for i in 0..src.len() {
|
|
LL | |
|
|
LL | |
|
|
LL | | dst[i] = src[i];
|
|
LL | | }
|
|
| |_____^ help: try replacing the loop by: `dst[..src.len()].copy_from_slice(&src[..]);`
|
|
|
|
|
= note: `-D clippy::manual-memcpy` implied by `-D warnings`
|
|
= help: to override `-D warnings` add `#[allow(clippy::manual_memcpy)]`
|
|
|
|
error: it looks like you're manually copying between slices
|
|
--> tests/ui/manual_memcpy/without_loop_counters.rs:16:5
|
|
|
|
|
LL | / for i in 0..src.len() {
|
|
LL | |
|
|
LL | | dst[i + 10] = src[i];
|
|
LL | | }
|
|
| |_____^ help: try replacing the loop by: `dst[10..(src.len() + 10)].copy_from_slice(&src[..]);`
|
|
|
|
error: it looks like you're manually copying between slices
|
|
--> tests/ui/manual_memcpy/without_loop_counters.rs:22:5
|
|
|
|
|
LL | / for i in 0..src.len() {
|
|
LL | |
|
|
LL | | dst[i] = src[i + 10];
|
|
LL | | }
|
|
| |_____^ help: try replacing the loop by: `dst[..src.len()].copy_from_slice(&src[10..(src.len() + 10)]);`
|
|
|
|
error: it looks like you're manually copying between slices
|
|
--> tests/ui/manual_memcpy/without_loop_counters.rs:28:5
|
|
|
|
|
LL | / for i in 11..src.len() {
|
|
LL | |
|
|
LL | | dst[i] = src[i - 10];
|
|
LL | | }
|
|
| |_____^ help: try replacing the loop by: `dst[11..src.len()].copy_from_slice(&src[(11 - 10)..(src.len() - 10)]);`
|
|
|
|
error: it looks like you're manually copying between slices
|
|
--> tests/ui/manual_memcpy/without_loop_counters.rs:34:5
|
|
|
|
|
LL | / for i in 0..dst.len() {
|
|
LL | |
|
|
LL | | dst[i] = src[i];
|
|
LL | | }
|
|
| |_____^ help: try replacing the loop by: `dst.copy_from_slice(&src[..dst.len()]);`
|
|
|
|
error: it looks like you're manually copying between slices
|
|
--> tests/ui/manual_memcpy/without_loop_counters.rs:48:5
|
|
|
|
|
LL | / for i in 10..256 {
|
|
LL | |
|
|
LL | | dst[i] = src[i - 5];
|
|
LL | | dst2[i + 500] = src[i]
|
|
LL | | }
|
|
| |_____^
|
|
|
|
|
help: try replacing the loop by
|
|
|
|
|
LL ~ dst[10..256].copy_from_slice(&src[(10 - 5)..(256 - 5)]);
|
|
LL + dst2[(10 + 500)..(256 + 500)].copy_from_slice(&src[10..256]);
|
|
|
|
|
|
|
error: it looks like you're manually copying between slices
|
|
--> tests/ui/manual_memcpy/without_loop_counters.rs:61:5
|
|
|
|
|
LL | / for i in 10..LOOP_OFFSET {
|
|
LL | |
|
|
LL | | dst[i + LOOP_OFFSET] = src[i - some_var];
|
|
LL | | }
|
|
| |_____^ help: try replacing the loop by: `dst[(10 + LOOP_OFFSET)..(LOOP_OFFSET + LOOP_OFFSET)].copy_from_slice(&src[(10 - some_var)..(LOOP_OFFSET - some_var)]);`
|
|
|
|
error: it looks like you're manually copying between slices
|
|
--> tests/ui/manual_memcpy/without_loop_counters.rs:75:5
|
|
|
|
|
LL | / for i in 0..src_vec.len() {
|
|
LL | |
|
|
LL | | dst_vec[i] = src_vec[i];
|
|
LL | | }
|
|
| |_____^ help: try replacing the loop by: `dst_vec[..src_vec.len()].copy_from_slice(&src_vec[..]);`
|
|
|
|
error: it looks like you're manually copying between slices
|
|
--> tests/ui/manual_memcpy/without_loop_counters.rs:105:5
|
|
|
|
|
LL | / for i in from..from + src.len() {
|
|
LL | |
|
|
LL | | dst[i] = src[i - from];
|
|
LL | | }
|
|
| |_____^ help: try replacing the loop by: `dst[from..(from + src.len())].copy_from_slice(&src[..(from + src.len() - from)]);`
|
|
|
|
error: it looks like you're manually copying between slices
|
|
--> tests/ui/manual_memcpy/without_loop_counters.rs:110:5
|
|
|
|
|
LL | / for i in from..from + 3 {
|
|
LL | |
|
|
LL | | dst[i] = src[i - from];
|
|
LL | | }
|
|
| |_____^ help: try replacing the loop by: `dst[from..(from + 3)].copy_from_slice(&src[..(from + 3 - from)]);`
|
|
|
|
error: it looks like you're manually copying between slices
|
|
--> tests/ui/manual_memcpy/without_loop_counters.rs:116:5
|
|
|
|
|
LL | / for i in 0..5 {
|
|
LL | |
|
|
LL | | dst[i - 0] = src[i];
|
|
LL | | }
|
|
| |_____^ help: try replacing the loop by: `dst[..5].copy_from_slice(&src);`
|
|
|
|
error: it looks like you're manually copying between slices
|
|
--> tests/ui/manual_memcpy/without_loop_counters.rs:122:5
|
|
|
|
|
LL | / for i in 0..0 {
|
|
LL | |
|
|
LL | | dst[i] = src[i];
|
|
LL | | }
|
|
| |_____^ help: try replacing the loop by: `dst[..0].copy_from_slice(&src[..0]);`
|
|
|
|
error: it looks like you're manually copying between slices
|
|
--> tests/ui/manual_memcpy/without_loop_counters.rs:146:5
|
|
|
|
|
LL | / for i in 0..4 {
|
|
LL | |
|
|
LL | | dst[i] = src[i];
|
|
LL | | }
|
|
| |_____^ help: try replacing the loop by: `dst.copy_from_slice(&src[..4]);`
|
|
|
|
error: it looks like you're manually copying between slices
|
|
--> tests/ui/manual_memcpy/without_loop_counters.rs:152:5
|
|
|
|
|
LL | / for i in 0..5 {
|
|
LL | |
|
|
LL | | dst[i] = src[i];
|
|
LL | | }
|
|
| |_____^ help: try replacing the loop by: `dst[..5].copy_from_slice(&src);`
|
|
|
|
error: it looks like you're manually copying between slices
|
|
--> tests/ui/manual_memcpy/without_loop_counters.rs:158:5
|
|
|
|
|
LL | / for i in 0..5 {
|
|
LL | |
|
|
LL | | dst[i] = src[i];
|
|
LL | | }
|
|
| |_____^ help: try replacing the loop by: `dst.copy_from_slice(&src);`
|
|
|
|
error: it looks like you're manually copying between slices
|
|
--> tests/ui/manual_memcpy/without_loop_counters.rs:205:5
|
|
|
|
|
LL | / for i in 0..5 {
|
|
LL | |
|
|
LL | | dst[i] = src[0][i];
|
|
LL | | }
|
|
| |_____^ help: try replacing the loop by: `dst.copy_from_slice(&src[0]);`
|
|
|
|
error: it looks like you're manually copying between slices
|
|
--> tests/ui/manual_memcpy/without_loop_counters.rs:211:5
|
|
|
|
|
LL | / for i in 0..5 {
|
|
LL | |
|
|
LL | | dst[i] = src[0][1][i];
|
|
LL | | }
|
|
| |_____^ help: try replacing the loop by: `dst.copy_from_slice(&src[0][1]);`
|
|
|
|
error: it looks like you're manually copying between slices
|
|
--> tests/ui/manual_memcpy/without_loop_counters.rs:219:5
|
|
|
|
|
LL | / for i in 0..src.len() {
|
|
LL | |
|
|
LL | | dst[i] = src[i].clone();
|
|
LL | | }
|
|
| |_____^ help: try replacing the loop by: `dst[..src.len()].clone_from_slice(&src[..]);`
|
|
|
|
error: aborting due to 18 previous errors
|
|
|