fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

master
4.9 KiB119 linesraw
1error: avoid using `collect()` when not needed
2  --> $DIR/needless_collect.rs:9:29
3   |
4LL |     let len = sample.iter().collect::<Vec<_>>().len();
5   |                             ^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `count()`
6   |
7   = note: `-D clippy::needless-collect` implied by `-D warnings`
8   = help: to override `-D warnings` add `#[allow(clippy::needless_collect)]`
9
10error: avoid using `collect()` when not needed
11  --> $DIR/needless_collect.rs:10:22
12   |
13LL |     if sample.iter().collect::<Vec<_>>().is_empty() {
14   |                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `next().is_none()`
15
16error: avoid using `collect()` when not needed
17  --> $DIR/needless_collect.rs:13:28
18   |
19LL |     sample.iter().cloned().collect::<Vec<_>>().contains(&1);
20   |                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `any(|x| x == 1)`
21
22error: avoid using `collect()` when not needed
23  --> $DIR/needless_collect.rs:18:35
24   |
25LL |     sample.iter().map(|x| (x, x)).collect::<HashMap<_, _>>().is_empty();
26   |                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `next().is_none()`
27
28error: avoid using `collect()` when not needed
29  --> $DIR/needless_collect.rs:19:35
30   |
31LL |     sample.iter().map(|x| (x, x)).collect::<BTreeMap<_, _>>().is_empty();
32   |                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `next().is_none()`
33
34error: avoid using `collect()` when not needed
35  --> $DIR/needless_collect.rs:26:19
36   |
37LL |     sample.iter().collect::<LinkedList<_>>().len();
38   |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `count()`
39
40error: avoid using `collect()` when not needed
41  --> $DIR/needless_collect.rs:27:19
42   |
43LL |     sample.iter().collect::<LinkedList<_>>().is_empty();
44   |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `next().is_none()`
45
46error: avoid using `collect()` when not needed
47  --> $DIR/needless_collect.rs:28:28
48   |
49LL |     sample.iter().cloned().collect::<LinkedList<_>>().contains(&1);
50   |                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `any(|x| x == 1)`
51
52error: avoid using `collect()` when not needed
53  --> $DIR/needless_collect.rs:29:19
54   |
55LL |     sample.iter().collect::<LinkedList<_>>().contains(&&1);
56   |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `any(|x| x == &1)`
57
58error: avoid using `collect()` when not needed
59  --> $DIR/needless_collect.rs:32:19
60   |
61LL |     sample.iter().collect::<BinaryHeap<_>>().len();
62   |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `count()`
63
64error: avoid using `collect()` when not needed
65  --> $DIR/needless_collect.rs:33:19
66   |
67LL |     sample.iter().collect::<BinaryHeap<_>>().is_empty();
68   |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `next().is_none()`
69
70error: avoid using `collect()` when not needed
71  --> $DIR/needless_collect.rs:38:27
72   |
73LL |     let _ = sample.iter().collect::<HashSet<_>>().is_empty();
74   |                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `next().is_none()`
75
76error: avoid using `collect()` when not needed
77  --> $DIR/needless_collect.rs:39:27
78   |
79LL |     let _ = sample.iter().collect::<HashSet<_>>().contains(&&0);
80   |                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `any(|x| x == &0)`
81
82error: avoid using `collect()` when not needed
83  --> $DIR/needless_collect.rs:61:27
84   |
85LL |     let _ = sample.iter().collect::<VecWrapper<_>>().is_empty();
86   |                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `next().is_none()`
87
88error: avoid using `collect()` when not needed
89  --> $DIR/needless_collect.rs:62:27
90   |
91LL |     let _ = sample.iter().collect::<VecWrapper<_>>().contains(&&0);
92   |                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `any(|x| x == &0)`
93
94error: avoid using `collect()` when not needed
95  --> $DIR/needless_collect.rs:66:40
96   |
97LL |         Vec::<u8>::new().extend((0..10).collect::<Vec<_>>());
98   |                                        ^^^^^^^^^^^^^^^^^^^^ help: remove this call
99
100error: avoid using `collect()` when not needed
101  --> $DIR/needless_collect.rs:67:20
102   |
103LL |         foo((0..10).collect::<Vec<_>>());
104   |                    ^^^^^^^^^^^^^^^^^^^^ help: remove this call
105
106error: avoid using `collect()` when not needed
107  --> $DIR/needless_collect.rs:68:49
108   |
109LL |         bar((0..10).collect::<Vec<_>>(), (0..10).collect::<Vec<_>>());
110   |                                                 ^^^^^^^^^^^^^^^^^^^^ help: remove this call
111
112error: avoid using `collect()` when not needed
113  --> $DIR/needless_collect.rs:69:37
114   |
115LL |         baz((0..10), (), ('a'..='z').collect::<Vec<_>>())
116   |                                     ^^^^^^^^^^^^^^^^^^^^ help: remove this call
117
118error: aborting due to 19 previous errors
119