about summary refs log tree commit diff
path: root/tests/ui/manual_memcpy/without_loop_counters.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/manual_memcpy/without_loop_counters.rs')
-rw-r--r--tests/ui/manual_memcpy/without_loop_counters.rs16
1 files changed, 15 insertions, 1 deletions
diff --git a/tests/ui/manual_memcpy/without_loop_counters.rs b/tests/ui/manual_memcpy/without_loop_counters.rs
index 4d5c70f19a0..a224001a3df 100644
--- a/tests/ui/manual_memcpy/without_loop_counters.rs
+++ b/tests/ui/manual_memcpy/without_loop_counters.rs
@@ -1,31 +1,37 @@
 #![warn(clippy::needless_range_loop, clippy::manual_memcpy)]
 #![allow(clippy::useless_vec)]
-
+//@no-rustfix
 const LOOP_OFFSET: usize = 5000;
 
 pub fn manual_copy(src: &[i32], dst: &mut [i32], dst2: &mut [i32]) {
     // plain manual memcpy
     for i in 0..src.len() {
+        //~^ ERROR: it looks like you're manually copying between slices
+        //~| NOTE: `-D clippy::manual-memcpy` implied by `-D warnings`
         dst[i] = src[i];
     }
 
     // dst offset memcpy
     for i in 0..src.len() {
+        //~^ ERROR: it looks like you're manually copying between slices
         dst[i + 10] = src[i];
     }
 
     // src offset memcpy
     for i in 0..src.len() {
+        //~^ ERROR: it looks like you're manually copying between slices
         dst[i] = src[i + 10];
     }
 
     // src offset memcpy
     for i in 11..src.len() {
+        //~^ ERROR: it looks like you're manually copying between slices
         dst[i] = src[i - 10];
     }
 
     // overwrite entire dst
     for i in 0..dst.len() {
+        //~^ ERROR: it looks like you're manually copying between slices
         dst[i] = src[i];
     }
 
@@ -39,6 +45,7 @@ pub fn manual_copy(src: &[i32], dst: &mut [i32], dst2: &mut [i32]) {
 
     // multiple copies - suggest two memcpy statements
     for i in 10..256 {
+        //~^ ERROR: it looks like you're manually copying between slices
         dst[i] = src[i - 5];
         dst2[i + 500] = src[i]
     }
@@ -51,6 +58,7 @@ pub fn manual_copy(src: &[i32], dst: &mut [i32], dst2: &mut [i32]) {
     let some_var = 5;
     // Offset in variable
     for i in 10..LOOP_OFFSET {
+        //~^ ERROR: it looks like you're manually copying between slices
         dst[i + LOOP_OFFSET] = src[i - some_var];
     }
 
@@ -64,6 +72,7 @@ pub fn manual_copy(src: &[i32], dst: &mut [i32], dst2: &mut [i32]) {
 
     // make sure vectors are supported
     for i in 0..src_vec.len() {
+        //~^ ERROR: it looks like you're manually copying between slices
         dst_vec[i] = src_vec[i];
     }
 
@@ -93,20 +102,24 @@ pub fn manual_copy(src: &[i32], dst: &mut [i32], dst2: &mut [i32]) {
     let from = 1;
 
     for i in from..from + src.len() {
+        //~^ ERROR: it looks like you're manually copying between slices
         dst[i] = src[i - from];
     }
 
     for i in from..from + 3 {
+        //~^ ERROR: it looks like you're manually copying between slices
         dst[i] = src[i - from];
     }
 
     #[allow(clippy::identity_op)]
     for i in 0..5 {
+        //~^ ERROR: it looks like you're manually copying between slices
         dst[i - 0] = src[i];
     }
 
     #[allow(clippy::reversed_empty_ranges)]
     for i in 0..0 {
+        //~^ ERROR: it looks like you're manually copying between slices
         dst[i] = src[i];
     }
 
@@ -130,6 +143,7 @@ pub fn manual_copy(src: &[i32], dst: &mut [i32], dst2: &mut [i32]) {
 #[warn(clippy::needless_range_loop, clippy::manual_memcpy)]
 pub fn manual_clone(src: &[String], dst: &mut [String]) {
     for i in 0..src.len() {
+        //~^ ERROR: it looks like you're manually copying between slices
         dst[i] = src[i].clone();
     }
 }