Skip to content

Commit

Permalink
ignore manual_slice_fill in other test files
Browse files Browse the repository at this point in the history
  • Loading branch information
lapla-cogito committed Jan 28, 2025
1 parent 609839e commit d7bd4a0
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 34 deletions.
7 changes: 6 additions & 1 deletion tests/ui/manual_memcpy/without_loop_counters.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
#![warn(clippy::manual_memcpy)]
#![allow(clippy::assigning_clones, clippy::useless_vec, clippy::needless_range_loop)]
#![allow(
clippy::assigning_clones,
clippy::useless_vec,
clippy::needless_range_loop,
clippy::manual_slice_fill
)]

//@no-rustfix
const LOOP_OFFSET: usize = 5000;
Expand Down
36 changes: 18 additions & 18 deletions tests/ui/manual_memcpy/without_loop_counters.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error: it looks like you're manually copying between slices
--> tests/ui/manual_memcpy/without_loop_counters.rs:9:5
--> tests/ui/manual_memcpy/without_loop_counters.rs:14:5
|
LL | / for i in 0..src.len() {
LL | |
Expand All @@ -12,7 +12,7 @@ LL | | }
= 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
--> tests/ui/manual_memcpy/without_loop_counters.rs:21:5
|
LL | / for i in 0..src.len() {
LL | |
Expand All @@ -21,7 +21,7 @@ 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
--> tests/ui/manual_memcpy/without_loop_counters.rs:27:5
|
LL | / for i in 0..src.len() {
LL | |
Expand All @@ -30,7 +30,7 @@ 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
--> tests/ui/manual_memcpy/without_loop_counters.rs:33:5
|
LL | / for i in 11..src.len() {
LL | |
Expand All @@ -39,7 +39,7 @@ 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
--> tests/ui/manual_memcpy/without_loop_counters.rs:39:5
|
LL | / for i in 0..dst.len() {
LL | |
Expand All @@ -48,7 +48,7 @@ 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
--> tests/ui/manual_memcpy/without_loop_counters.rs:53:5
|
LL | / for i in 10..256 {
LL | |
Expand All @@ -64,7 +64,7 @@ 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
--> tests/ui/manual_memcpy/without_loop_counters.rs:66:5
|
LL | / for i in 10..LOOP_OFFSET {
LL | |
Expand All @@ -73,7 +73,7 @@ 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
--> tests/ui/manual_memcpy/without_loop_counters.rs:80:5
|
LL | / for i in 0..src_vec.len() {
LL | |
Expand All @@ -82,7 +82,7 @@ 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
--> tests/ui/manual_memcpy/without_loop_counters.rs:110:5
|
LL | / for i in from..from + src.len() {
LL | |
Expand All @@ -91,7 +91,7 @@ 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
--> tests/ui/manual_memcpy/without_loop_counters.rs:115:5
|
LL | / for i in from..from + 3 {
LL | |
Expand All @@ -100,7 +100,7 @@ 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
--> tests/ui/manual_memcpy/without_loop_counters.rs:121:5
|
LL | / for i in 0..5 {
LL | |
Expand All @@ -109,7 +109,7 @@ 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
--> tests/ui/manual_memcpy/without_loop_counters.rs:127:5
|
LL | / for i in 0..0 {
LL | |
Expand All @@ -118,7 +118,7 @@ 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
--> tests/ui/manual_memcpy/without_loop_counters.rs:151:5
|
LL | / for i in 0..4 {
LL | |
Expand All @@ -127,7 +127,7 @@ 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
--> tests/ui/manual_memcpy/without_loop_counters.rs:157:5
|
LL | / for i in 0..5 {
LL | |
Expand All @@ -136,7 +136,7 @@ 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
--> tests/ui/manual_memcpy/without_loop_counters.rs:163:5
|
LL | / for i in 0..5 {
LL | |
Expand All @@ -145,7 +145,7 @@ 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
--> tests/ui/manual_memcpy/without_loop_counters.rs:210:5
|
LL | / for i in 0..5 {
LL | |
Expand All @@ -154,7 +154,7 @@ 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
--> tests/ui/manual_memcpy/without_loop_counters.rs:216:5
|
LL | / for i in 0..5 {
LL | |
Expand All @@ -163,7 +163,7 @@ 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
--> tests/ui/manual_memcpy/without_loop_counters.rs:224:5
|
LL | / for i in 0..src.len() {
LL | |
Expand Down
3 changes: 2 additions & 1 deletion tests/ui/needless_range_loop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
#![allow(
clippy::uninlined_format_args,
clippy::unnecessary_literal_unwrap,
clippy::useless_vec
clippy::useless_vec,
clippy::manual_slice_fill
)]
//@no-rustfix
static STATIC: [usize; 4] = [0, 1, 8, 16];
Expand Down
28 changes: 14 additions & 14 deletions tests/ui/needless_range_loop.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error: the loop variable `i` is only used to index `vec`
--> tests/ui/needless_range_loop.rs:15:14
--> tests/ui/needless_range_loop.rs:16:14
|
LL | for i in 0..vec.len() {
| ^^^^^^^^^^^^
Expand All @@ -12,7 +12,7 @@ LL | for <item> in &vec {
| ~~~~~~ ~~~~

error: the loop variable `i` is only used to index `vec`
--> tests/ui/needless_range_loop.rs:26:14
--> tests/ui/needless_range_loop.rs:27:14
|
LL | for i in 0..vec.len() {
| ^^^^^^^^^^^^
Expand All @@ -23,7 +23,7 @@ LL | for <item> in &vec {
| ~~~~~~ ~~~~

error: the loop variable `j` is only used to index `STATIC`
--> tests/ui/needless_range_loop.rs:32:14
--> tests/ui/needless_range_loop.rs:33:14
|
LL | for j in 0..4 {
| ^^^^
Expand All @@ -34,7 +34,7 @@ LL | for <item> in &STATIC {
| ~~~~~~ ~~~~~~~

error: the loop variable `j` is only used to index `CONST`
--> tests/ui/needless_range_loop.rs:37:14
--> tests/ui/needless_range_loop.rs:38:14
|
LL | for j in 0..4 {
| ^^^^
Expand All @@ -45,7 +45,7 @@ LL | for <item> in &CONST {
| ~~~~~~ ~~~~~~

error: the loop variable `i` is used to index `vec`
--> tests/ui/needless_range_loop.rs:42:14
--> tests/ui/needless_range_loop.rs:43:14
|
LL | for i in 0..vec.len() {
| ^^^^^^^^^^^^
Expand All @@ -56,7 +56,7 @@ LL | for (i, <item>) in vec.iter().enumerate() {
| ~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~

error: the loop variable `i` is only used to index `vec2`
--> tests/ui/needless_range_loop.rs:51:14
--> tests/ui/needless_range_loop.rs:52:14
|
LL | for i in 0..vec.len() {
| ^^^^^^^^^^^^
Expand All @@ -67,7 +67,7 @@ LL | for <item> in vec2.iter().take(vec.len()) {
| ~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~

error: the loop variable `i` is only used to index `vec`
--> tests/ui/needless_range_loop.rs:56:14
--> tests/ui/needless_range_loop.rs:57:14
|
LL | for i in 5..vec.len() {
| ^^^^^^^^^^^^
Expand All @@ -78,7 +78,7 @@ LL | for <item> in vec.iter().skip(5) {
| ~~~~~~ ~~~~~~~~~~~~~~~~~~

error: the loop variable `i` is only used to index `vec`
--> tests/ui/needless_range_loop.rs:61:14
--> tests/ui/needless_range_loop.rs:62:14
|
LL | for i in 0..MAX_LEN {
| ^^^^^^^^^^
Expand All @@ -89,7 +89,7 @@ LL | for <item> in vec.iter().take(MAX_LEN) {
| ~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~

error: the loop variable `i` is only used to index `vec`
--> tests/ui/needless_range_loop.rs:66:14
--> tests/ui/needless_range_loop.rs:67:14
|
LL | for i in 0..=MAX_LEN {
| ^^^^^^^^^^^
Expand All @@ -100,7 +100,7 @@ LL | for <item> in vec.iter().take(MAX_LEN + 1) {
| ~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~

error: the loop variable `i` is only used to index `vec`
--> tests/ui/needless_range_loop.rs:71:14
--> tests/ui/needless_range_loop.rs:72:14
|
LL | for i in 5..10 {
| ^^^^^
Expand All @@ -111,7 +111,7 @@ LL | for <item> in vec.iter().take(10).skip(5) {
| ~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~

error: the loop variable `i` is only used to index `vec`
--> tests/ui/needless_range_loop.rs:76:14
--> tests/ui/needless_range_loop.rs:77:14
|
LL | for i in 5..=10 {
| ^^^^^^
Expand All @@ -122,7 +122,7 @@ LL | for <item> in vec.iter().take(10 + 1).skip(5) {
| ~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

error: the loop variable `i` is used to index `vec`
--> tests/ui/needless_range_loop.rs:81:14
--> tests/ui/needless_range_loop.rs:82:14
|
LL | for i in 5..vec.len() {
| ^^^^^^^^^^^^
Expand All @@ -133,7 +133,7 @@ LL | for (i, <item>) in vec.iter().enumerate().skip(5) {
| ~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

error: the loop variable `i` is used to index `vec`
--> tests/ui/needless_range_loop.rs:86:14
--> tests/ui/needless_range_loop.rs:87:14
|
LL | for i in 5..10 {
| ^^^^^
Expand All @@ -144,7 +144,7 @@ LL | for (i, <item>) in vec.iter().enumerate().take(10).skip(5) {
| ~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

error: the loop variable `i` is used to index `vec`
--> tests/ui/needless_range_loop.rs:92:14
--> tests/ui/needless_range_loop.rs:93:14
|
LL | for i in 0..vec.len() {
| ^^^^^^^^^^^^
Expand Down

0 comments on commit d7bd4a0

Please sign in to comment.