never_loop
catches loop { panic!() }
This commit is contained in:
parent
b3980d8497
commit
44f64acb7e
@ -3,7 +3,8 @@ fn main() {}
|
||||
fn no_panic<T>(slice: &[T]) {
|
||||
let mut iter = slice.iter();
|
||||
loop {
|
||||
//~^ ERROR: this loop could be written as a `while let` loop
|
||||
//~^ ERROR: this loop never actually loops
|
||||
//~| ERROR: this loop could be written as a `while let` loop
|
||||
//~| NOTE: `-D clippy::while-let-loop` implied by `-D warnings`
|
||||
let _ = match iter.next() {
|
||||
Some(ele) => ele,
|
||||
|
@ -1,10 +1,24 @@
|
||||
error: this loop never actually loops
|
||||
--> $DIR/ice-360.rs:5:5
|
||||
|
|
||||
LL | / loop {
|
||||
LL | |
|
||||
LL | |
|
||||
LL | |
|
||||
... |
|
||||
LL | |
|
||||
LL | | }
|
||||
| |_____^
|
||||
|
|
||||
= note: `#[deny(clippy::never_loop)]` on by default
|
||||
|
||||
error: this loop could be written as a `while let` loop
|
||||
--> $DIR/ice-360.rs:5:5
|
||||
|
|
||||
LL | / loop {
|
||||
LL | |
|
||||
LL | |
|
||||
LL | | let _ = match iter.next() {
|
||||
LL | |
|
||||
... |
|
||||
LL | |
|
||||
LL | | }
|
||||
@ -13,7 +27,7 @@ LL | | }
|
||||
= note: `-D clippy::while-let-loop` implied by `-D warnings`
|
||||
|
||||
error: empty `loop {}` wastes CPU cycles
|
||||
--> $DIR/ice-360.rs:12:9
|
||||
--> $DIR/ice-360.rs:13:9
|
||||
|
|
||||
LL | loop {}
|
||||
| ^^^^^^^
|
||||
@ -21,5 +35,5 @@ LL | loop {}
|
||||
= help: you should either use `panic!()` or add `std::thread::sleep(..);` to the loop body
|
||||
= note: `-D clippy::empty-loop` implied by `-D warnings`
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
|
@ -7,10 +7,12 @@ use proc_macros::{external, inline_macros};
|
||||
|
||||
fn should_trigger() {
|
||||
loop {}
|
||||
#[allow(clippy::never_loop)]
|
||||
loop {
|
||||
loop {}
|
||||
}
|
||||
|
||||
#[allow(clippy::never_loop)]
|
||||
'outer: loop {
|
||||
'inner: loop {}
|
||||
}
|
||||
@ -18,6 +20,7 @@ fn should_trigger() {
|
||||
|
||||
#[inline_macros]
|
||||
fn should_not_trigger() {
|
||||
#[allow(clippy::never_loop)]
|
||||
loop {
|
||||
panic!("This is fine")
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ LL | loop {}
|
||||
= note: `-D clippy::empty-loop` implied by `-D warnings`
|
||||
|
||||
error: empty `loop {}` wastes CPU cycles
|
||||
--> $DIR/empty_loop.rs:11:9
|
||||
--> $DIR/empty_loop.rs:12:9
|
||||
|
|
||||
LL | loop {}
|
||||
| ^^^^^^^
|
||||
@ -16,7 +16,7 @@ LL | loop {}
|
||||
= help: you should either use `panic!()` or add `std::thread::sleep(..);` to the loop body
|
||||
|
||||
error: empty `loop {}` wastes CPU cycles
|
||||
--> $DIR/empty_loop.rs:15:9
|
||||
--> $DIR/empty_loop.rs:17:9
|
||||
|
|
||||
LL | 'inner: loop {}
|
||||
| ^^^^^^^^^^^^^^^
|
||||
|
@ -8,6 +8,7 @@ fn opaque_empty_iter() -> impl Iterator<Item = ()> {
|
||||
}
|
||||
|
||||
fn main() {
|
||||
#[allow(clippy::never_loop)]
|
||||
for _ in [1, 2, 3].iter().skip(4) {
|
||||
//~^ ERROR: this `.skip()` call skips more items than the iterator will produce
|
||||
unreachable!();
|
||||
|
@ -1,5 +1,5 @@
|
||||
error: this `.skip()` call skips more items than the iterator will produce
|
||||
--> $DIR/iter_out_of_bounds.rs:11:14
|
||||
--> $DIR/iter_out_of_bounds.rs:12:14
|
||||
|
|
||||
LL | for _ in [1, 2, 3].iter().skip(4) {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -12,7 +12,7 @@ LL | #![deny(clippy::iter_out_of_bounds)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: this `.take()` call takes more items than the iterator will produce
|
||||
--> $DIR/iter_out_of_bounds.rs:15:19
|
||||
--> $DIR/iter_out_of_bounds.rs:16:19
|
||||
|
|
||||
LL | for (i, _) in [1, 2, 3].iter().take(4).enumerate() {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -20,7 +20,7 @@ LL | for (i, _) in [1, 2, 3].iter().take(4).enumerate() {
|
||||
= note: this operation is useless and the returned iterator will simply yield the same items
|
||||
|
||||
error: this `.take()` call takes more items than the iterator will produce
|
||||
--> $DIR/iter_out_of_bounds.rs:21:14
|
||||
--> $DIR/iter_out_of_bounds.rs:22:14
|
||||
|
|
||||
LL | for _ in (&&&&&&[1, 2, 3]).iter().take(4) {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -28,7 +28,7 @@ LL | for _ in (&&&&&&[1, 2, 3]).iter().take(4) {}
|
||||
= note: this operation is useless and the returned iterator will simply yield the same items
|
||||
|
||||
error: this `.skip()` call skips more items than the iterator will produce
|
||||
--> $DIR/iter_out_of_bounds.rs:24:14
|
||||
--> $DIR/iter_out_of_bounds.rs:25:14
|
||||
|
|
||||
LL | for _ in [1, 2, 3].iter().skip(4) {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -36,7 +36,7 @@ LL | for _ in [1, 2, 3].iter().skip(4) {}
|
||||
= note: this operation is useless and will create an empty iterator
|
||||
|
||||
error: this `.skip()` call skips more items than the iterator will produce
|
||||
--> $DIR/iter_out_of_bounds.rs:27:14
|
||||
--> $DIR/iter_out_of_bounds.rs:28:14
|
||||
|
|
||||
LL | for _ in [1; 3].iter().skip(4) {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -44,7 +44,7 @@ LL | for _ in [1; 3].iter().skip(4) {}
|
||||
= note: this operation is useless and will create an empty iterator
|
||||
|
||||
error: this `.skip()` call skips more items than the iterator will produce
|
||||
--> $DIR/iter_out_of_bounds.rs:33:14
|
||||
--> $DIR/iter_out_of_bounds.rs:34:14
|
||||
|
|
||||
LL | for _ in vec![1, 2, 3].iter().skip(4) {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -52,7 +52,7 @@ LL | for _ in vec![1, 2, 3].iter().skip(4) {}
|
||||
= note: this operation is useless and will create an empty iterator
|
||||
|
||||
error: this `.skip()` call skips more items than the iterator will produce
|
||||
--> $DIR/iter_out_of_bounds.rs:36:14
|
||||
--> $DIR/iter_out_of_bounds.rs:37:14
|
||||
|
|
||||
LL | for _ in vec![1; 3].iter().skip(4) {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -60,7 +60,7 @@ LL | for _ in vec![1; 3].iter().skip(4) {}
|
||||
= note: this operation is useless and will create an empty iterator
|
||||
|
||||
error: this `.skip()` call skips more items than the iterator will produce
|
||||
--> $DIR/iter_out_of_bounds.rs:40:14
|
||||
--> $DIR/iter_out_of_bounds.rs:41:14
|
||||
|
|
||||
LL | for _ in x.iter().skip(4) {}
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
@ -68,7 +68,7 @@ LL | for _ in x.iter().skip(4) {}
|
||||
= note: this operation is useless and will create an empty iterator
|
||||
|
||||
error: this `.skip()` call skips more items than the iterator will produce
|
||||
--> $DIR/iter_out_of_bounds.rs:44:14
|
||||
--> $DIR/iter_out_of_bounds.rs:45:14
|
||||
|
|
||||
LL | for _ in x.iter().skip(n) {}
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
@ -76,7 +76,7 @@ LL | for _ in x.iter().skip(n) {}
|
||||
= note: this operation is useless and will create an empty iterator
|
||||
|
||||
error: this `.skip()` call skips more items than the iterator will produce
|
||||
--> $DIR/iter_out_of_bounds.rs:49:14
|
||||
--> $DIR/iter_out_of_bounds.rs:50:14
|
||||
|
|
||||
LL | for _ in empty().skip(1) {}
|
||||
| ^^^^^^^^^^^^^^^
|
||||
@ -84,7 +84,7 @@ LL | for _ in empty().skip(1) {}
|
||||
= note: this operation is useless and will create an empty iterator
|
||||
|
||||
error: this `.take()` call takes more items than the iterator will produce
|
||||
--> $DIR/iter_out_of_bounds.rs:52:14
|
||||
--> $DIR/iter_out_of_bounds.rs:53:14
|
||||
|
|
||||
LL | for _ in empty().take(1) {}
|
||||
| ^^^^^^^^^^^^^^^
|
||||
@ -92,7 +92,7 @@ LL | for _ in empty().take(1) {}
|
||||
= note: this operation is useless and the returned iterator will simply yield the same items
|
||||
|
||||
error: this `.skip()` call skips more items than the iterator will produce
|
||||
--> $DIR/iter_out_of_bounds.rs:55:14
|
||||
--> $DIR/iter_out_of_bounds.rs:56:14
|
||||
|
|
||||
LL | for _ in std::iter::once(1).skip(2) {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -100,7 +100,7 @@ LL | for _ in std::iter::once(1).skip(2) {}
|
||||
= note: this operation is useless and will create an empty iterator
|
||||
|
||||
error: this `.take()` call takes more items than the iterator will produce
|
||||
--> $DIR/iter_out_of_bounds.rs:58:14
|
||||
--> $DIR/iter_out_of_bounds.rs:59:14
|
||||
|
|
||||
LL | for _ in std::iter::once(1).take(2) {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -108,7 +108,7 @@ LL | for _ in std::iter::once(1).take(2) {}
|
||||
= note: this operation is useless and the returned iterator will simply yield the same items
|
||||
|
||||
error: this `.take()` call takes more items than the iterator will produce
|
||||
--> $DIR/iter_out_of_bounds.rs:61:14
|
||||
--> $DIR/iter_out_of_bounds.rs:62:14
|
||||
|
|
||||
LL | for x in [].iter().take(1) {
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
@ -260,6 +260,7 @@ mod issue_8553 {
|
||||
let w = v.iter().collect::<Vec<_>>();
|
||||
//~^ ERROR: avoid using `collect()` when not needed
|
||||
// Do lint
|
||||
#[allow(clippy::never_loop)]
|
||||
for _ in 0..w.len() {
|
||||
todo!();
|
||||
}
|
||||
@ -270,6 +271,7 @@ mod issue_8553 {
|
||||
let v: Vec<usize> = vec.iter().map(|i| i * i).collect();
|
||||
let w = v.iter().collect::<Vec<_>>();
|
||||
// Do not lint, because w is used.
|
||||
#[allow(clippy::never_loop)]
|
||||
for _ in 0..w.len() {
|
||||
todo!();
|
||||
}
|
||||
@ -283,6 +285,7 @@ mod issue_8553 {
|
||||
let mut w = v.iter().collect::<Vec<_>>();
|
||||
//~^ ERROR: avoid using `collect()` when not needed
|
||||
// Do lint
|
||||
#[allow(clippy::never_loop)]
|
||||
while 1 == w.len() {
|
||||
todo!();
|
||||
}
|
||||
@ -293,6 +296,7 @@ mod issue_8553 {
|
||||
let mut v: Vec<usize> = vec.iter().map(|i| i * i).collect();
|
||||
let mut w = v.iter().collect::<Vec<_>>();
|
||||
// Do not lint, because w is used.
|
||||
#[allow(clippy::never_loop)]
|
||||
while 1 == w.len() {
|
||||
todo!();
|
||||
}
|
||||
@ -306,6 +310,7 @@ mod issue_8553 {
|
||||
let mut w = v.iter().collect::<Vec<_>>();
|
||||
//~^ ERROR: avoid using `collect()` when not needed
|
||||
// Do lint
|
||||
#[allow(clippy::never_loop)]
|
||||
while let Some(i) = Some(w.len()) {
|
||||
todo!();
|
||||
}
|
||||
@ -316,6 +321,7 @@ mod issue_8553 {
|
||||
let mut v: Vec<usize> = vec.iter().map(|i| i * i).collect();
|
||||
let mut w = v.iter().collect::<Vec<_>>();
|
||||
// Do not lint, because w is used.
|
||||
#[allow(clippy::never_loop)]
|
||||
while let Some(i) = Some(w.len()) {
|
||||
todo!();
|
||||
}
|
||||
|
@ -230,11 +230,12 @@ help: take the original Iterator's count instead of collecting it and finding th
|
||||
LL ~
|
||||
LL |
|
||||
LL | // Do lint
|
||||
LL | #[allow(clippy::never_loop)]
|
||||
LL ~ for _ in 0..v.iter().count() {
|
||||
|
|
||||
|
||||
error: avoid using `collect()` when not needed
|
||||
--> $DIR/needless_collect_indirect.rs:283:30
|
||||
--> $DIR/needless_collect_indirect.rs:285:30
|
||||
|
|
||||
LL | let mut w = v.iter().collect::<Vec<_>>();
|
||||
| ^^^^^^^
|
||||
@ -247,11 +248,12 @@ help: take the original Iterator's count instead of collecting it and finding th
|
||||
LL ~
|
||||
LL |
|
||||
LL | // Do lint
|
||||
LL | #[allow(clippy::never_loop)]
|
||||
LL ~ while 1 == v.iter().count() {
|
||||
|
|
||||
|
||||
error: avoid using `collect()` when not needed
|
||||
--> $DIR/needless_collect_indirect.rs:306:30
|
||||
--> $DIR/needless_collect_indirect.rs:310:30
|
||||
|
|
||||
LL | let mut w = v.iter().collect::<Vec<_>>();
|
||||
| ^^^^^^^
|
||||
@ -264,6 +266,7 @@ help: take the original Iterator's count instead of collecting it and finding th
|
||||
LL ~
|
||||
LL |
|
||||
LL | // Do lint
|
||||
LL | #[allow(clippy::never_loop)]
|
||||
LL ~ while let Some(i) = Some(v.iter().count()) {
|
||||
|
|
||||
|
||||
|
@ -3,6 +3,7 @@
|
||||
unused,
|
||||
clippy::println_empty_string,
|
||||
clippy::empty_loop,
|
||||
clippy::never_loop,
|
||||
clippy::diverging_sub_expression,
|
||||
clippy::let_unit_value
|
||||
)]
|
||||
|
@ -1,84 +1,84 @@
|
||||
error: binding's name is too similar to existing binding
|
||||
--> $DIR/similar_names.rs:21:9
|
||||
--> $DIR/similar_names.rs:22:9
|
||||
|
|
||||
LL | let bpple: i32;
|
||||
| ^^^^^
|
||||
|
|
||||
note: existing binding defined here
|
||||
--> $DIR/similar_names.rs:19:9
|
||||
--> $DIR/similar_names.rs:20:9
|
||||
|
|
||||
LL | let apple: i32;
|
||||
| ^^^^^
|
||||
= note: `-D clippy::similar-names` implied by `-D warnings`
|
||||
|
||||
error: binding's name is too similar to existing binding
|
||||
--> $DIR/similar_names.rs:24:9
|
||||
--> $DIR/similar_names.rs:25:9
|
||||
|
|
||||
LL | let cpple: i32;
|
||||
| ^^^^^
|
||||
|
|
||||
note: existing binding defined here
|
||||
--> $DIR/similar_names.rs:19:9
|
||||
--> $DIR/similar_names.rs:20:9
|
||||
|
|
||||
LL | let apple: i32;
|
||||
| ^^^^^
|
||||
|
||||
error: binding's name is too similar to existing binding
|
||||
--> $DIR/similar_names.rs:49:9
|
||||
--> $DIR/similar_names.rs:50:9
|
||||
|
|
||||
LL | let bluby: i32;
|
||||
| ^^^^^
|
||||
|
|
||||
note: existing binding defined here
|
||||
--> $DIR/similar_names.rs:48:9
|
||||
--> $DIR/similar_names.rs:49:9
|
||||
|
|
||||
LL | let blubx: i32;
|
||||
| ^^^^^
|
||||
|
||||
error: binding's name is too similar to existing binding
|
||||
--> $DIR/similar_names.rs:54:9
|
||||
--> $DIR/similar_names.rs:55:9
|
||||
|
|
||||
LL | let coke: i32;
|
||||
| ^^^^
|
||||
|
|
||||
note: existing binding defined here
|
||||
--> $DIR/similar_names.rs:52:9
|
||||
--> $DIR/similar_names.rs:53:9
|
||||
|
|
||||
LL | let cake: i32;
|
||||
| ^^^^
|
||||
|
||||
error: binding's name is too similar to existing binding
|
||||
--> $DIR/similar_names.rs:73:9
|
||||
--> $DIR/similar_names.rs:74:9
|
||||
|
|
||||
LL | let xyzeabc: i32;
|
||||
| ^^^^^^^
|
||||
|
|
||||
note: existing binding defined here
|
||||
--> $DIR/similar_names.rs:71:9
|
||||
--> $DIR/similar_names.rs:72:9
|
||||
|
|
||||
LL | let xyz1abc: i32;
|
||||
| ^^^^^^^
|
||||
|
||||
error: binding's name is too similar to existing binding
|
||||
--> $DIR/similar_names.rs:78:9
|
||||
--> $DIR/similar_names.rs:79:9
|
||||
|
|
||||
LL | let parsee: i32;
|
||||
| ^^^^^^
|
||||
|
|
||||
note: existing binding defined here
|
||||
--> $DIR/similar_names.rs:76:9
|
||||
--> $DIR/similar_names.rs:77:9
|
||||
|
|
||||
LL | let parser: i32;
|
||||
| ^^^^^^
|
||||
|
||||
error: binding's name is too similar to existing binding
|
||||
--> $DIR/similar_names.rs:100:16
|
||||
--> $DIR/similar_names.rs:101:16
|
||||
|
|
||||
LL | bpple: sprang,
|
||||
| ^^^^^^
|
||||
|
|
||||
note: existing binding defined here
|
||||
--> $DIR/similar_names.rs:99:16
|
||||
--> $DIR/similar_names.rs:100:16
|
||||
|
|
||||
LL | apple: spring,
|
||||
| ^^^^^^
|
||||
|
@ -1,5 +1,10 @@
|
||||
#![warn(clippy::useless_vec)]
|
||||
#![allow(clippy::nonstandard_macro_braces, clippy::uninlined_format_args, unused)]
|
||||
#![allow(
|
||||
clippy::nonstandard_macro_braces,
|
||||
clippy::never_loop,
|
||||
clippy::uninlined_format_args,
|
||||
unused
|
||||
)]
|
||||
|
||||
use std::rc::Rc;
|
||||
|
||||
|
@ -1,5 +1,10 @@
|
||||
#![warn(clippy::useless_vec)]
|
||||
#![allow(clippy::nonstandard_macro_braces, clippy::uninlined_format_args, unused)]
|
||||
#![allow(
|
||||
clippy::nonstandard_macro_braces,
|
||||
clippy::never_loop,
|
||||
clippy::uninlined_format_args,
|
||||
unused
|
||||
)]
|
||||
|
||||
use std::rc::Rc;
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
error: useless use of `vec!`
|
||||
--> $DIR/vec.rs:30:14
|
||||
--> $DIR/vec.rs:35:14
|
||||
|
|
||||
LL | on_slice(&vec![]);
|
||||
| ^^^^^^^ help: you can use a slice directly: `&[]`
|
||||
@ -7,109 +7,109 @@ LL | on_slice(&vec![]);
|
||||
= note: `-D clippy::useless-vec` implied by `-D warnings`
|
||||
|
||||
error: useless use of `vec!`
|
||||
--> $DIR/vec.rs:32:18
|
||||
--> $DIR/vec.rs:37:18
|
||||
|
|
||||
LL | on_mut_slice(&mut vec![]);
|
||||
| ^^^^^^^^^^^ help: you can use a slice directly: `&mut []`
|
||||
|
||||
error: useless use of `vec!`
|
||||
--> $DIR/vec.rs:34:14
|
||||
--> $DIR/vec.rs:39:14
|
||||
|
|
||||
LL | on_slice(&vec![1, 2]);
|
||||
| ^^^^^^^^^^^ help: you can use a slice directly: `&[1, 2]`
|
||||
|
||||
error: useless use of `vec!`
|
||||
--> $DIR/vec.rs:36:18
|
||||
--> $DIR/vec.rs:41:18
|
||||
|
|
||||
LL | on_mut_slice(&mut vec![1, 2]);
|
||||
| ^^^^^^^^^^^^^^^ help: you can use a slice directly: `&mut [1, 2]`
|
||||
|
||||
error: useless use of `vec!`
|
||||
--> $DIR/vec.rs:38:14
|
||||
--> $DIR/vec.rs:43:14
|
||||
|
|
||||
LL | on_slice(&vec![1, 2]);
|
||||
| ^^^^^^^^^^^ help: you can use a slice directly: `&[1, 2]`
|
||||
|
||||
error: useless use of `vec!`
|
||||
--> $DIR/vec.rs:40:18
|
||||
--> $DIR/vec.rs:45:18
|
||||
|
|
||||
LL | on_mut_slice(&mut vec![1, 2]);
|
||||
| ^^^^^^^^^^^^^^^ help: you can use a slice directly: `&mut [1, 2]`
|
||||
|
||||
error: useless use of `vec!`
|
||||
--> $DIR/vec.rs:42:14
|
||||
--> $DIR/vec.rs:47:14
|
||||
|
|
||||
LL | on_slice(&vec!(1, 2));
|
||||
| ^^^^^^^^^^^ help: you can use a slice directly: `&[1, 2]`
|
||||
|
||||
error: useless use of `vec!`
|
||||
--> $DIR/vec.rs:44:18
|
||||
--> $DIR/vec.rs:49:18
|
||||
|
|
||||
LL | on_mut_slice(&mut vec![1, 2]);
|
||||
| ^^^^^^^^^^^^^^^ help: you can use a slice directly: `&mut [1, 2]`
|
||||
|
||||
error: useless use of `vec!`
|
||||
--> $DIR/vec.rs:46:14
|
||||
--> $DIR/vec.rs:51:14
|
||||
|
|
||||
LL | on_slice(&vec![1; 2]);
|
||||
| ^^^^^^^^^^^ help: you can use a slice directly: `&[1; 2]`
|
||||
|
||||
error: useless use of `vec!`
|
||||
--> $DIR/vec.rs:48:18
|
||||
--> $DIR/vec.rs:53:18
|
||||
|
|
||||
LL | on_mut_slice(&mut vec![1; 2]);
|
||||
| ^^^^^^^^^^^^^^^ help: you can use a slice directly: `&mut [1; 2]`
|
||||
|
||||
error: useless use of `vec!`
|
||||
--> $DIR/vec.rs:74:19
|
||||
--> $DIR/vec.rs:79:19
|
||||
|
|
||||
LL | let _x: i32 = vec![1, 2, 3].iter().sum();
|
||||
| ^^^^^^^^^^^^^ help: you can use an array directly: `[1, 2, 3]`
|
||||
|
||||
error: useless use of `vec!`
|
||||
--> $DIR/vec.rs:77:17
|
||||
--> $DIR/vec.rs:82:17
|
||||
|
|
||||
LL | let mut x = vec![1, 2, 3];
|
||||
| ^^^^^^^^^^^^^ help: you can use an array directly: `[1, 2, 3]`
|
||||
|
||||
error: useless use of `vec!`
|
||||
--> $DIR/vec.rs:83:22
|
||||
--> $DIR/vec.rs:88:22
|
||||
|
|
||||
LL | let _x: &[i32] = &vec![1, 2, 3];
|
||||
| ^^^^^^^^^^^^^^ help: you can use a slice directly: `&[1, 2, 3]`
|
||||
|
||||
error: useless use of `vec!`
|
||||
--> $DIR/vec.rs:85:14
|
||||
--> $DIR/vec.rs:90:14
|
||||
|
|
||||
LL | for _ in vec![1, 2, 3] {}
|
||||
| ^^^^^^^^^^^^^ help: you can use an array directly: `[1, 2, 3]`
|
||||
|
||||
error: useless use of `vec!`
|
||||
--> $DIR/vec.rs:123:20
|
||||
--> $DIR/vec.rs:128:20
|
||||
|
|
||||
LL | for _string in vec![repro!(true), repro!(null)] {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: you can use an array directly: `[repro!(true), repro!(null)]`
|
||||
|
||||
error: useless use of `vec!`
|
||||
--> $DIR/vec.rs:140:18
|
||||
--> $DIR/vec.rs:145:18
|
||||
|
|
||||
LL | in_macro!(1, vec![1, 2], vec![1; 2]);
|
||||
| ^^^^^^^^^^ help: you can use an array directly: `[1, 2]`
|
||||
|
||||
error: useless use of `vec!`
|
||||
--> $DIR/vec.rs:140:30
|
||||
--> $DIR/vec.rs:145:30
|
||||
|
|
||||
LL | in_macro!(1, vec![1, 2], vec![1; 2]);
|
||||
| ^^^^^^^^^^ help: you can use an array directly: `[1; 2]`
|
||||
|
||||
error: useless use of `vec!`
|
||||
--> $DIR/vec.rs:159:14
|
||||
--> $DIR/vec.rs:164:14
|
||||
|
|
||||
LL | for a in vec![1, 2, 3] {
|
||||
| ^^^^^^^^^^^^^ help: you can use an array directly: `[1, 2, 3]`
|
||||
|
||||
error: useless use of `vec!`
|
||||
--> $DIR/vec.rs:163:14
|
||||
--> $DIR/vec.rs:168:14
|
||||
|
|
||||
LL | for a in vec![String::new(), String::new()] {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: you can use an array directly: `[String::new(), String::new()]`
|
||||
|
Loading…
x
Reference in New Issue
Block a user