1error: avoid using `collect()` when not needed
2  --> $DIR/needless_collect_indirect.rs:5:39
3   |
4LL |     let indirect_iter = sample.iter().collect::<Vec<_>>();
5   |                                       ^^^^^^^
6LL |     indirect_iter.into_iter().map(|x| (x, x + 1)).collect::<HashMap<_, _>>();
7   |     ------------------------- the iterator could be used here instead
8   |
9   = note: `-D clippy::needless-collect` implied by `-D warnings`
10help: use the original Iterator instead of collecting it and then producing a new one
11   |
12LL ~
13LL ~     sample.iter().map(|x| (x, x + 1)).collect::<HashMap<_, _>>();
14   |
15
16error: avoid using `collect()` when not needed
17  --> $DIR/needless_collect_indirect.rs:7:38
18   |
19LL |     let indirect_len = sample.iter().collect::<VecDeque<_>>();
20   |                                      ^^^^^^^
21LL |     indirect_len.len();
22   |     ------------------ the iterator could be used here instead
23   |
24help: take the original Iterator's count instead of collecting it and finding the length
25   |
26LL ~
27LL ~     sample.iter().count();
28   |
29
30error: avoid using `collect()` when not needed
31  --> $DIR/needless_collect_indirect.rs:9:40
32   |
33LL |     let indirect_empty = sample.iter().collect::<VecDeque<_>>();
34   |                                        ^^^^^^^
35LL |     indirect_empty.is_empty();
36   |     ------------------------- the iterator could be used here instead
37   |
38help: check if the original Iterator has anything instead of collecting it and seeing if it's empty
39   |
40LL ~
41LL ~     sample.iter().next().is_none();
42   |
43
44error: avoid using `collect()` when not needed
45  --> $DIR/needless_collect_indirect.rs:11:43
46   |
47LL |     let indirect_contains = sample.iter().collect::<VecDeque<_>>();
48   |                                           ^^^^^^^
49LL |     indirect_contains.contains(&&5);
50   |     ------------------------------- the iterator could be used here instead
51   |
52help: check if the original Iterator contains an element instead of collecting then checking
53   |
54LL ~
55LL ~     sample.iter().any(|x| x == &5);
56   |
57
58error: avoid using `collect()` when not needed
59  --> $DIR/needless_collect_indirect.rs:23:48
60   |
61LL |     let non_copy_contains = sample.into_iter().collect::<Vec<_>>();
62   |                                                ^^^^^^^
63LL |     non_copy_contains.contains(&a);
64   |     ------------------------------ the iterator could be used here instead
65   |
66help: check if the original Iterator contains an element instead of collecting then checking
67   |
68LL ~
69LL ~     sample.into_iter().any(|x| x == a);
70   |
71
72error: avoid using `collect()` when not needed
73  --> $DIR/needless_collect_indirect.rs:52:51
74   |
75LL |         let buffer: Vec<&str> = string.split('/').collect();
76   |                                                   ^^^^^^^
77LL |         buffer.len()
78   |         ------------ the iterator could be used here instead
79   |
80help: take the original Iterator's count instead of collecting it and finding the length
81   |
82LL ~
83LL ~         string.split('/').count()
84   |
85
86error: avoid using `collect()` when not needed
87  --> $DIR/needless_collect_indirect.rs:57:55
88   |
89LL |         let indirect_len: VecDeque<_> = sample.iter().collect();
90   |                                                       ^^^^^^^
91LL |         indirect_len.len()
92   |         ------------------ the iterator could be used here instead
93   |
94help: take the original Iterator's count instead of collecting it and finding the length
95   |
96LL ~
97LL ~         sample.iter().count()
98   |
99
100error: avoid using `collect()` when not needed
101  --> $DIR/needless_collect_indirect.rs:62:57
102   |
103LL |         let indirect_len: LinkedList<_> = sample.iter().collect();
104   |                                                         ^^^^^^^
105LL |         indirect_len.len()
106   |         ------------------ the iterator could be used here instead
107   |
108help: take the original Iterator's count instead of collecting it and finding the length
109   |
110LL ~
111LL ~         sample.iter().count()
112   |
113
114error: avoid using `collect()` when not needed
115  --> $DIR/needless_collect_indirect.rs:67:57
116   |
117LL |         let indirect_len: BinaryHeap<_> = sample.iter().collect();
118   |                                                         ^^^^^^^
119LL |         indirect_len.len()
120   |         ------------------ the iterator could be used here instead
121   |
122help: take the original Iterator's count instead of collecting it and finding the length
123   |
124LL ~
125LL ~         sample.iter().count()
126   |
127
128error: aborting due to 9 previous errors
129
130