Update the corresponding test and bless tests

This commit is contained in:
JT 2022-10-25 07:28:09 +13:00
parent 0e360d0b21
commit 4f3fb0081d
2 changed files with 17 additions and 16 deletions

View file

@ -1,4 +1,5 @@
#![allow(clippy::uninlined_format_args)] #![allow(clippy::uninlined_format_args)]
#![warn(clippy::needless_collect)]
use std::collections::{BinaryHeap, HashMap, HashSet, LinkedList, VecDeque}; use std::collections::{BinaryHeap, HashMap, HashSet, LinkedList, VecDeque};

View file

@ -1,5 +1,5 @@
error: avoid using `collect()` when not needed error: avoid using `collect()` when not needed
--> $DIR/needless_collect_indirect.rs:7:39 --> $DIR/needless_collect_indirect.rs:8:39
| |
LL | let indirect_iter = sample.iter().collect::<Vec<_>>(); LL | let indirect_iter = sample.iter().collect::<Vec<_>>();
| ^^^^^^^ | ^^^^^^^
@ -14,7 +14,7 @@ LL ~ sample.iter().map(|x| (x, x + 1)).collect::<HashMap<_, _>>();
| |
error: avoid using `collect()` when not needed error: avoid using `collect()` when not needed
--> $DIR/needless_collect_indirect.rs:9:38 --> $DIR/needless_collect_indirect.rs:10:38
| |
LL | let indirect_len = sample.iter().collect::<VecDeque<_>>(); LL | let indirect_len = sample.iter().collect::<VecDeque<_>>();
| ^^^^^^^ | ^^^^^^^
@ -28,7 +28,7 @@ LL ~ sample.iter().count();
| |
error: avoid using `collect()` when not needed error: avoid using `collect()` when not needed
--> $DIR/needless_collect_indirect.rs:11:40 --> $DIR/needless_collect_indirect.rs:12:40
| |
LL | let indirect_empty = sample.iter().collect::<VecDeque<_>>(); LL | let indirect_empty = sample.iter().collect::<VecDeque<_>>();
| ^^^^^^^ | ^^^^^^^
@ -42,7 +42,7 @@ LL ~ sample.iter().next().is_none();
| |
error: avoid using `collect()` when not needed error: avoid using `collect()` when not needed
--> $DIR/needless_collect_indirect.rs:13:43 --> $DIR/needless_collect_indirect.rs:14:43
| |
LL | let indirect_contains = sample.iter().collect::<VecDeque<_>>(); LL | let indirect_contains = sample.iter().collect::<VecDeque<_>>();
| ^^^^^^^ | ^^^^^^^
@ -56,7 +56,7 @@ LL ~ sample.iter().any(|x| x == &5);
| |
error: avoid using `collect()` when not needed error: avoid using `collect()` when not needed
--> $DIR/needless_collect_indirect.rs:25:48 --> $DIR/needless_collect_indirect.rs:26:48
| |
LL | let non_copy_contains = sample.into_iter().collect::<Vec<_>>(); LL | let non_copy_contains = sample.into_iter().collect::<Vec<_>>();
| ^^^^^^^ | ^^^^^^^
@ -70,7 +70,7 @@ LL ~ sample.into_iter().any(|x| x == a);
| |
error: avoid using `collect()` when not needed error: avoid using `collect()` when not needed
--> $DIR/needless_collect_indirect.rs:54:51 --> $DIR/needless_collect_indirect.rs:55:51
| |
LL | let buffer: Vec<&str> = string.split('/').collect(); LL | let buffer: Vec<&str> = string.split('/').collect();
| ^^^^^^^ | ^^^^^^^
@ -84,7 +84,7 @@ LL ~ string.split('/').count()
| |
error: avoid using `collect()` when not needed error: avoid using `collect()` when not needed
--> $DIR/needless_collect_indirect.rs:59:55 --> $DIR/needless_collect_indirect.rs:60:55
| |
LL | let indirect_len: VecDeque<_> = sample.iter().collect(); LL | let indirect_len: VecDeque<_> = sample.iter().collect();
| ^^^^^^^ | ^^^^^^^
@ -98,7 +98,7 @@ LL ~ sample.iter().count()
| |
error: avoid using `collect()` when not needed error: avoid using `collect()` when not needed
--> $DIR/needless_collect_indirect.rs:64:57 --> $DIR/needless_collect_indirect.rs:65:57
| |
LL | let indirect_len: LinkedList<_> = sample.iter().collect(); LL | let indirect_len: LinkedList<_> = sample.iter().collect();
| ^^^^^^^ | ^^^^^^^
@ -112,7 +112,7 @@ LL ~ sample.iter().count()
| |
error: avoid using `collect()` when not needed error: avoid using `collect()` when not needed
--> $DIR/needless_collect_indirect.rs:69:57 --> $DIR/needless_collect_indirect.rs:70:57
| |
LL | let indirect_len: BinaryHeap<_> = sample.iter().collect(); LL | let indirect_len: BinaryHeap<_> = sample.iter().collect();
| ^^^^^^^ | ^^^^^^^
@ -126,7 +126,7 @@ LL ~ sample.iter().count()
| |
error: avoid using `collect()` when not needed error: avoid using `collect()` when not needed
--> $DIR/needless_collect_indirect.rs:129:59 --> $DIR/needless_collect_indirect.rs:130:59
| |
LL | let y: Vec<usize> = vec.iter().map(|k| k * k).collect(); LL | let y: Vec<usize> = vec.iter().map(|k| k * k).collect();
| ^^^^^^^ | ^^^^^^^
@ -143,7 +143,7 @@ LL ~ vec.iter().map(|k| k * k).any(|x| x == i);
| |
error: avoid using `collect()` when not needed error: avoid using `collect()` when not needed
--> $DIR/needless_collect_indirect.rs:154:59 --> $DIR/needless_collect_indirect.rs:155:59
| |
LL | let y: Vec<usize> = vec.iter().map(|k| k * k).collect(); LL | let y: Vec<usize> = vec.iter().map(|k| k * k).collect();
| ^^^^^^^ | ^^^^^^^
@ -160,7 +160,7 @@ LL ~ vec.iter().map(|k| k * k).any(|x| x == n);
| |
error: avoid using `collect()` when not needed error: avoid using `collect()` when not needed
--> $DIR/needless_collect_indirect.rs:183:63 --> $DIR/needless_collect_indirect.rs:184:63
| |
LL | let y: Vec<usize> = vec.iter().map(|k| k * k).collect(); LL | let y: Vec<usize> = vec.iter().map(|k| k * k).collect();
| ^^^^^^^ | ^^^^^^^
@ -177,7 +177,7 @@ LL ~ vec.iter().map(|k| k * k).any(|x| x == n);
| |
error: avoid using `collect()` when not needed error: avoid using `collect()` when not needed
--> $DIR/needless_collect_indirect.rs:219:59 --> $DIR/needless_collect_indirect.rs:220:59
| |
LL | let y: Vec<usize> = vec.iter().map(|k| k * k).collect(); LL | let y: Vec<usize> = vec.iter().map(|k| k * k).collect();
| ^^^^^^^ | ^^^^^^^
@ -195,7 +195,7 @@ LL ~ vec.iter().map(|k| k * k).any(|x| x == n);
| |
error: avoid using `collect()` when not needed error: avoid using `collect()` when not needed
--> $DIR/needless_collect_indirect.rs:244:26 --> $DIR/needless_collect_indirect.rs:245:26
| |
LL | let w = v.iter().collect::<Vec<_>>(); LL | let w = v.iter().collect::<Vec<_>>();
| ^^^^^^^ | ^^^^^^^
@ -211,7 +211,7 @@ LL ~ for _ in 0..v.iter().count() {
| |
error: avoid using `collect()` when not needed error: avoid using `collect()` when not needed
--> $DIR/needless_collect_indirect.rs:266:30 --> $DIR/needless_collect_indirect.rs:267:30
| |
LL | let mut w = v.iter().collect::<Vec<_>>(); LL | let mut w = v.iter().collect::<Vec<_>>();
| ^^^^^^^ | ^^^^^^^
@ -227,7 +227,7 @@ LL ~ while 1 == v.iter().count() {
| |
error: avoid using `collect()` when not needed error: avoid using `collect()` when not needed
--> $DIR/needless_collect_indirect.rs:288:30 --> $DIR/needless_collect_indirect.rs:289:30
| |
LL | let mut w = v.iter().collect::<Vec<_>>(); LL | let mut w = v.iter().collect::<Vec<_>>();
| ^^^^^^^ | ^^^^^^^