2017-02-07 21:05:30 +01:00
|
|
|
error: for loop over `option`, which is an `Option`. This is more readably written as an `if let` statement.
|
|
|
|
--> $DIR/for_loop.rs:18:14
|
|
|
|
|
|
|
|
|
18 | for x in option {
|
|
|
|
| ^^^^^^
|
|
|
|
|
|
|
|
|
= note: #[deny(for_loop_over_option)] implied by #[deny(clippy)]
|
|
|
|
note: lint level defined here
|
|
|
|
--> $DIR/for_loop.rs:10:8
|
|
|
|
|
|
|
|
|
10 | #[deny(clippy)]
|
|
|
|
| ^^^^^^
|
|
|
|
= help: consider replacing `for x in option` with `if let Some(x) = option`
|
|
|
|
|
|
|
|
error: for loop over `result`, which is a `Result`. This is more readably written as an `if let` statement.
|
|
|
|
--> $DIR/for_loop.rs:26:14
|
|
|
|
|
|
|
|
|
26 | for x in result {
|
|
|
|
| ^^^^^^
|
|
|
|
|
|
|
|
|
= note: #[deny(for_loop_over_result)] implied by #[deny(clippy)]
|
|
|
|
note: lint level defined here
|
|
|
|
--> $DIR/for_loop.rs:10:8
|
|
|
|
|
|
|
|
|
10 | #[deny(clippy)]
|
|
|
|
| ^^^^^^
|
|
|
|
= help: consider replacing `for x in result` with `if let Ok(x) = result`
|
|
|
|
|
|
|
|
error: for loop over `option.ok_or("x not found")`, which is a `Result`. This is more readably written as an `if let` statement.
|
|
|
|
--> $DIR/for_loop.rs:32:14
|
|
|
|
|
|
|
|
|
32 | for x in option.ok_or("x not found") {
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
|
= note: #[deny(for_loop_over_result)] implied by #[deny(clippy)]
|
|
|
|
= help: consider replacing `for x in option.ok_or("x not found")` with `if let Ok(x) = option.ok_or("x not found")`
|
|
|
|
|
|
|
|
error: you are iterating over `Iterator::next()` which is an Option; this will compile but is probably not what you want
|
|
|
|
--> $DIR/for_loop.rs:40:5
|
|
|
|
|
|
2017-04-23 15:25:22 +02:00
|
|
|
40 | / for x in v.iter().next() {
|
2017-02-08 14:58:07 +01:00
|
|
|
41 | |
|
2017-02-07 21:05:30 +01:00
|
|
|
42 | | println!("{}", x);
|
|
|
|
43 | | }
|
2017-04-23 15:25:22 +02:00
|
|
|
| |_____^
|
2017-02-07 21:05:30 +01:00
|
|
|
|
|
|
|
|
= note: #[deny(iter_next_loop)] implied by #[deny(clippy)]
|
|
|
|
note: lint level defined here
|
|
|
|
--> $DIR/for_loop.rs:10:8
|
|
|
|
|
|
|
|
|
10 | #[deny(clippy)]
|
|
|
|
| ^^^^^^
|
|
|
|
|
|
|
|
error: for loop over `v.iter().next().and(Some(0))`, which is an `Option`. This is more readably written as an `if let` statement.
|
|
|
|
--> $DIR/for_loop.rs:47:14
|
|
|
|
|
|
|
|
|
47 | for x in v.iter().next().and(Some(0)) {
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
|
= note: #[deny(for_loop_over_option)] implied by #[deny(clippy)]
|
|
|
|
= help: consider replacing `for x in v.iter().next().and(Some(0))` with `if let Some(x) = v.iter().next().and(Some(0))`
|
|
|
|
|
|
|
|
error: for loop over `v.iter().next().ok_or("x not found")`, which is a `Result`. This is more readably written as an `if let` statement.
|
|
|
|
--> $DIR/for_loop.rs:53:14
|
|
|
|
|
|
|
|
|
53 | for x in v.iter().next().ok_or("x not found") {
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
|
= note: #[deny(for_loop_over_result)] implied by #[deny(clippy)]
|
|
|
|
= help: consider replacing `for x in v.iter().next().ok_or("x not found")` with `if let Ok(x) = v.iter().next().ok_or("x not found")`
|
|
|
|
|
|
|
|
error: the loop variable `i` is only used to index `vec`.
|
|
|
|
--> $DIR/for_loop.rs:99:5
|
|
|
|
|
|
2017-04-23 15:25:22 +02:00
|
|
|
99 | / for i in 0..vec.len() {
|
2017-02-08 14:58:07 +01:00
|
|
|
100 | |
|
|
|
|
101 | |
|
|
|
|
102 | |
|
|
|
|
103 | |
|
2017-02-07 21:05:30 +01:00
|
|
|
104 | | println!("{}", vec[i]);
|
|
|
|
105 | | }
|
2017-04-23 15:25:22 +02:00
|
|
|
| |_____^
|
2017-02-07 21:05:30 +01:00
|
|
|
|
|
|
|
|
note: lint level defined here
|
|
|
|
--> $DIR/for_loop.rs:90:8
|
|
|
|
|
|
|
|
|
90 | #[deny(needless_range_loop, explicit_iter_loop, explicit_into_iter_loop, iter_next_loop, reverse_range_loop, explicit_counter_loop, for_kv_map)]
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^
|
|
|
|
help: consider using an iterator
|
|
|
|
| for <item> in &vec {
|
|
|
|
|
|
|
|
warning: unused variable: `i`
|
|
|
|
--> $DIR/for_loop.rs:107:9
|
|
|
|
|
|
|
|
|
107 | for i in 0..vec.len() {
|
|
|
|
| ^
|
|
|
|
|
|
|
|
|
= note: #[warn(unused_variables)] on by default
|
|
|
|
|
|
|
|
error: the loop variable `i` is only used to index `vec`.
|
|
|
|
--> $DIR/for_loop.rs:113:5
|
|
|
|
|
|
|
|
|
113 | for i in 0..vec.len() { let _ = vec[i]; }
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
|
help: consider using an iterator
|
|
|
|
| for <item> in &vec { let _ = vec[i]; }
|
|
|
|
|
|
|
|
error: the loop variable `j` is only used to index `STATIC`.
|
|
|
|
--> $DIR/for_loop.rs:120:5
|
|
|
|
|
|
2017-04-23 15:25:22 +02:00
|
|
|
120 | / for j in 0..4 {
|
2017-02-08 14:58:07 +01:00
|
|
|
121 | |
|
|
|
|
122 | |
|
|
|
|
123 | |
|
|
|
|
124 | |
|
2017-02-07 21:05:30 +01:00
|
|
|
125 | | println!("{:?}", STATIC[j]);
|
|
|
|
126 | | }
|
2017-04-23 15:25:22 +02:00
|
|
|
| |_____^
|
2017-02-07 21:05:30 +01:00
|
|
|
|
|
|
|
|
help: consider using an iterator
|
|
|
|
| for <item> in STATIC.iter().take(4) {
|
|
|
|
|
|
|
|
error: the loop variable `j` is only used to index `CONST`.
|
|
|
|
--> $DIR/for_loop.rs:128:5
|
|
|
|
|
|
2017-04-23 15:25:22 +02:00
|
|
|
128 | / for j in 0..4 {
|
2017-02-08 14:58:07 +01:00
|
|
|
129 | |
|
|
|
|
130 | |
|
|
|
|
131 | |
|
|
|
|
132 | |
|
2017-02-07 21:05:30 +01:00
|
|
|
133 | | println!("{:?}", CONST[j]);
|
|
|
|
134 | | }
|
2017-04-23 15:25:22 +02:00
|
|
|
| |_____^
|
2017-02-07 21:05:30 +01:00
|
|
|
|
|
|
|
|
help: consider using an iterator
|
|
|
|
| for <item> in CONST.iter().take(4) {
|
|
|
|
|
|
|
|
error: the loop variable `i` is used to index `vec`
|
|
|
|
--> $DIR/for_loop.rs:136:5
|
|
|
|
|
|
2017-04-23 15:25:22 +02:00
|
|
|
136 | / for i in 0..vec.len() {
|
2017-02-08 14:58:07 +01:00
|
|
|
137 | |
|
|
|
|
138 | |
|
|
|
|
139 | |
|
|
|
|
140 | |
|
2017-02-07 21:05:30 +01:00
|
|
|
141 | | println!("{} {}", vec[i], i);
|
|
|
|
142 | | }
|
2017-04-23 15:25:22 +02:00
|
|
|
| |_____^
|
2017-02-07 21:05:30 +01:00
|
|
|
|
|
|
|
|
help: consider using an iterator
|
|
|
|
| for (i, <item>) in vec.iter().enumerate() {
|
|
|
|
|
|
|
|
error: the loop variable `i` is only used to index `vec2`.
|
|
|
|
--> $DIR/for_loop.rs:147:5
|
|
|
|
|
|
2017-04-23 15:25:22 +02:00
|
|
|
147 | / for i in 0..vec.len() {
|
2017-02-08 14:58:07 +01:00
|
|
|
148 | |
|
|
|
|
149 | |
|
|
|
|
150 | |
|
|
|
|
151 | |
|
2017-02-07 21:05:30 +01:00
|
|
|
152 | | println!("{}", vec2[i]);
|
|
|
|
153 | | }
|
2017-04-23 15:25:22 +02:00
|
|
|
| |_____^
|
2017-02-07 21:05:30 +01:00
|
|
|
|
|
|
|
|
help: consider using an iterator
|
|
|
|
| for <item> in vec2.iter().take(vec.len()) {
|
|
|
|
|
|
|
|
error: the loop variable `i` is only used to index `vec`.
|
|
|
|
--> $DIR/for_loop.rs:155:5
|
|
|
|
|
|
2017-04-23 15:25:22 +02:00
|
|
|
155 | / for i in 5..vec.len() {
|
2017-02-08 14:58:07 +01:00
|
|
|
156 | |
|
|
|
|
157 | |
|
|
|
|
158 | |
|
|
|
|
159 | |
|
2017-02-07 21:05:30 +01:00
|
|
|
160 | | println!("{}", vec[i]);
|
|
|
|
161 | | }
|
2017-04-23 15:25:22 +02:00
|
|
|
| |_____^
|
2017-02-07 21:05:30 +01:00
|
|
|
|
|
|
|
|
help: consider using an iterator
|
|
|
|
| for <item> in vec.iter().skip(5) {
|
|
|
|
|
|
|
|
error: the loop variable `i` is only used to index `vec`.
|
|
|
|
--> $DIR/for_loop.rs:163:5
|
|
|
|
|
|
2017-04-23 15:25:22 +02:00
|
|
|
163 | / for i in 0..MAX_LEN {
|
2017-02-08 14:58:07 +01:00
|
|
|
164 | |
|
|
|
|
165 | |
|
|
|
|
166 | |
|
|
|
|
167 | |
|
2017-02-07 21:05:30 +01:00
|
|
|
168 | | println!("{}", vec[i]);
|
|
|
|
169 | | }
|
2017-04-23 15:25:22 +02:00
|
|
|
| |_____^
|
2017-02-07 21:05:30 +01:00
|
|
|
|
|
|
|
|
help: consider using an iterator
|
|
|
|
| for <item> in vec.iter().take(MAX_LEN) {
|
|
|
|
|
|
|
|
error: the loop variable `i` is only used to index `vec`.
|
|
|
|
--> $DIR/for_loop.rs:171:5
|
|
|
|
|
|
2017-04-23 15:25:22 +02:00
|
|
|
171 | / for i in 0...MAX_LEN {
|
2017-02-08 14:58:07 +01:00
|
|
|
172 | |
|
|
|
|
173 | |
|
|
|
|
174 | |
|
|
|
|
175 | |
|
2017-02-07 21:05:30 +01:00
|
|
|
176 | | println!("{}", vec[i]);
|
|
|
|
177 | | }
|
2017-04-23 15:25:22 +02:00
|
|
|
| |_____^
|
2017-02-07 21:05:30 +01:00
|
|
|
|
|
|
|
|
help: consider using an iterator
|
|
|
|
| for <item> in vec.iter().take(MAX_LEN + 1) {
|
|
|
|
|
|
|
|
error: the loop variable `i` is only used to index `vec`.
|
|
|
|
--> $DIR/for_loop.rs:179:5
|
|
|
|
|
|
2017-04-23 15:25:22 +02:00
|
|
|
179 | / for i in 5..10 {
|
2017-02-08 14:58:07 +01:00
|
|
|
180 | |
|
|
|
|
181 | |
|
|
|
|
182 | |
|
|
|
|
183 | |
|
2017-02-07 21:05:30 +01:00
|
|
|
184 | | println!("{}", vec[i]);
|
|
|
|
185 | | }
|
2017-04-23 15:25:22 +02:00
|
|
|
| |_____^
|
2017-02-07 21:05:30 +01:00
|
|
|
|
|
|
|
|
help: consider using an iterator
|
|
|
|
| for <item> in vec.iter().take(10).skip(5) {
|
|
|
|
|
|
|
|
error: the loop variable `i` is only used to index `vec`.
|
|
|
|
--> $DIR/for_loop.rs:187:5
|
|
|
|
|
|
2017-04-23 15:25:22 +02:00
|
|
|
187 | / for i in 5...10 {
|
2017-02-08 14:58:07 +01:00
|
|
|
188 | |
|
|
|
|
189 | |
|
|
|
|
190 | |
|
|
|
|
191 | |
|
2017-02-07 21:05:30 +01:00
|
|
|
192 | | println!("{}", vec[i]);
|
|
|
|
193 | | }
|
2017-04-23 15:25:22 +02:00
|
|
|
| |_____^
|
2017-02-07 21:05:30 +01:00
|
|
|
|
|
|
|
|
help: consider using an iterator
|
|
|
|
| for <item> in vec.iter().take(10 + 1).skip(5) {
|
|
|
|
|
|
|
|
error: the loop variable `i` is used to index `vec`
|
|
|
|
--> $DIR/for_loop.rs:195:5
|
|
|
|
|
|
2017-04-23 15:25:22 +02:00
|
|
|
195 | / for i in 5..vec.len() {
|
2017-02-08 14:58:07 +01:00
|
|
|
196 | |
|
|
|
|
197 | |
|
|
|
|
198 | |
|
|
|
|
199 | |
|
2017-02-07 21:05:30 +01:00
|
|
|
200 | | println!("{} {}", vec[i], i);
|
|
|
|
201 | | }
|
2017-04-23 15:25:22 +02:00
|
|
|
| |_____^
|
2017-02-07 21:05:30 +01:00
|
|
|
|
|
|
|
|
help: consider using an iterator
|
|
|
|
| for (i, <item>) in vec.iter().enumerate().skip(5) {
|
|
|
|
|
|
|
|
error: the loop variable `i` is used to index `vec`
|
|
|
|
--> $DIR/for_loop.rs:203:5
|
|
|
|
|
|
2017-04-23 15:25:22 +02:00
|
|
|
203 | / for i in 5..10 {
|
2017-02-08 14:58:07 +01:00
|
|
|
204 | |
|
|
|
|
205 | |
|
|
|
|
206 | |
|
|
|
|
207 | |
|
2017-02-07 21:05:30 +01:00
|
|
|
208 | | println!("{} {}", vec[i], i);
|
|
|
|
209 | | }
|
2017-04-23 15:25:22 +02:00
|
|
|
| |_____^
|
2017-02-07 21:05:30 +01:00
|
|
|
|
|
|
|
|
help: consider using an iterator
|
|
|
|
| for (i, <item>) in vec.iter().enumerate().take(10).skip(5) {
|
|
|
|
|
|
|
|
error: this range is empty so this for loop will never run
|
|
|
|
--> $DIR/for_loop.rs:211:5
|
|
|
|
|
|
2017-04-23 15:25:22 +02:00
|
|
|
211 | / for i in 10..0 {
|
2017-02-08 14:58:07 +01:00
|
|
|
212 | |
|
|
|
|
213 | |
|
|
|
|
214 | |
|
2017-02-07 21:05:30 +01:00
|
|
|
215 | | println!("{}", i);
|
|
|
|
216 | | }
|
2017-04-23 15:25:22 +02:00
|
|
|
| |_____^
|
2017-02-07 21:05:30 +01:00
|
|
|
|
|
|
|
|
note: lint level defined here
|
|
|
|
--> $DIR/for_loop.rs:90:90
|
|
|
|
|
|
|
|
|
90 | #[deny(needless_range_loop, explicit_iter_loop, explicit_into_iter_loop, iter_next_loop, reverse_range_loop, explicit_counter_loop, for_kv_map)]
|
|
|
|
| ^^^^^^^^^^^^^^^^^^
|
|
|
|
help: consider using the following if you are attempting to iterate over this range in reverse
|
|
|
|
| for i in (0..10).rev() {
|
|
|
|
|
|
|
|
error: this range is empty so this for loop will never run
|
|
|
|
--> $DIR/for_loop.rs:218:5
|
|
|
|
|
|
2017-04-23 15:25:22 +02:00
|
|
|
218 | / for i in 10...0 {
|
2017-02-08 14:58:07 +01:00
|
|
|
219 | |
|
|
|
|
220 | |
|
|
|
|
221 | |
|
2017-02-07 21:05:30 +01:00
|
|
|
222 | | println!("{}", i);
|
|
|
|
223 | | }
|
2017-04-23 15:25:22 +02:00
|
|
|
| |_____^
|
2017-02-07 21:05:30 +01:00
|
|
|
|
|
|
|
|
help: consider using the following if you are attempting to iterate over this range in reverse
|
|
|
|
| for i in (0...10).rev() {
|
|
|
|
|
|
|
|
error: this range is empty so this for loop will never run
|
|
|
|
--> $DIR/for_loop.rs:225:5
|
|
|
|
|
|
2017-04-23 15:25:22 +02:00
|
|
|
225 | / for i in MAX_LEN..0 {
|
2017-02-08 14:58:07 +01:00
|
|
|
226 | |
|
|
|
|
227 | |
|
2017-02-07 21:05:30 +01:00
|
|
|
228 | | println!("{}", i);
|
|
|
|
229 | | }
|
2017-04-23 15:25:22 +02:00
|
|
|
| |_____^
|
2017-02-07 21:05:30 +01:00
|
|
|
|
|
|
|
|
help: consider using the following if you are attempting to iterate over this range in reverse
|
2017-02-08 14:58:07 +01:00
|
|
|
| for i in (0..MAX_LEN).rev() {
|
2017-02-07 21:05:30 +01:00
|
|
|
|
|
|
|
error: this range is empty so this for loop will never run
|
|
|
|
--> $DIR/for_loop.rs:231:5
|
|
|
|
|
|
2017-04-23 15:25:22 +02:00
|
|
|
231 | / for i in 5..5 {
|
2017-02-07 21:05:30 +01:00
|
|
|
232 | | println!("{}", i);
|
|
|
|
233 | | }
|
2017-04-23 15:25:22 +02:00
|
|
|
| |_____^
|
2017-02-07 21:05:30 +01:00
|
|
|
|
|
|
|
error: this range is empty so this for loop will never run
|
|
|
|
--> $DIR/for_loop.rs:252:5
|
|
|
|
|
|
2017-04-23 15:25:22 +02:00
|
|
|
252 | / for i in 10..5+4 {
|
2017-02-08 14:58:07 +01:00
|
|
|
253 | |
|
|
|
|
254 | |
|
|
|
|
255 | |
|
2017-02-07 21:05:30 +01:00
|
|
|
256 | | println!("{}", i);
|
|
|
|
257 | | }
|
2017-04-23 15:25:22 +02:00
|
|
|
| |_____^
|
2017-02-07 21:05:30 +01:00
|
|
|
|
|
|
|
|
help: consider using the following if you are attempting to iterate over this range in reverse
|
|
|
|
| for i in (5+4..10).rev() {
|
|
|
|
|
|
|
|
error: this range is empty so this for loop will never run
|
|
|
|
--> $DIR/for_loop.rs:259:5
|
|
|
|
|
|
2017-04-23 15:25:22 +02:00
|
|
|
259 | / for i in (5+2)..(3-1) {
|
2017-02-08 14:58:07 +01:00
|
|
|
260 | |
|
|
|
|
261 | |
|
|
|
|
262 | |
|
2017-02-07 21:05:30 +01:00
|
|
|
263 | | println!("{}", i);
|
|
|
|
264 | | }
|
2017-04-23 15:25:22 +02:00
|
|
|
| |_____^
|
2017-02-07 21:05:30 +01:00
|
|
|
|
|
|
|
|
help: consider using the following if you are attempting to iterate over this range in reverse
|
|
|
|
| for i in ((3-1)..(5+2)).rev() {
|
|
|
|
|
|
|
|
error: this range is empty so this for loop will never run
|
|
|
|
--> $DIR/for_loop.rs:266:5
|
|
|
|
|
|
2017-04-23 15:25:22 +02:00
|
|
|
266 | / for i in (5+2)..(8-1) {
|
2017-02-07 21:05:30 +01:00
|
|
|
267 | | println!("{}", i);
|
|
|
|
268 | | }
|
2017-04-23 15:25:22 +02:00
|
|
|
| |_____^
|
2017-02-07 21:05:30 +01:00
|
|
|
|
2017-02-21 12:13:44 +01:00
|
|
|
error: it is more idiomatic to loop over references to containers instead of using explicit iteration methods
|
2017-02-07 21:05:30 +01:00
|
|
|
--> $DIR/for_loop.rs:289:15
|
|
|
|
|
|
|
|
|
289 | for _v in vec.iter() { }
|
2017-05-03 12:51:47 +02:00
|
|
|
| ^^^^^^^^^^ help: to write this more concisely, try `&vec`
|
2017-02-07 21:05:30 +01:00
|
|
|
|
|
|
|
|
note: lint level defined here
|
|
|
|
--> $DIR/for_loop.rs:90:29
|
|
|
|
|
|
|
|
|
90 | #[deny(needless_range_loop, explicit_iter_loop, explicit_into_iter_loop, iter_next_loop, reverse_range_loop, explicit_counter_loop, for_kv_map)]
|
|
|
|
| ^^^^^^^^^^^^^^^^^^
|
|
|
|
|
2017-02-21 12:13:44 +01:00
|
|
|
error: it is more idiomatic to loop over references to containers instead of using explicit iteration methods
|
2017-02-07 21:05:30 +01:00
|
|
|
--> $DIR/for_loop.rs:294:15
|
|
|
|
|
|
|
|
|
294 | for _v in vec.iter_mut() { }
|
2017-05-03 12:51:47 +02:00
|
|
|
| ^^^^^^^^^^^^^^ help: to write this more concisely, try `&mut vec`
|
2017-02-07 21:05:30 +01:00
|
|
|
|
2017-02-21 12:13:44 +01:00
|
|
|
error: it is more idiomatic to loop over containers instead of using explicit iteration methods`
|
2017-02-07 21:05:30 +01:00
|
|
|
--> $DIR/for_loop.rs:300:15
|
|
|
|
|
|
|
|
|
300 | for _v in out_vec.into_iter() { }
|
2017-05-03 12:51:47 +02:00
|
|
|
| ^^^^^^^^^^^^^^^^^^^ help: to write this more concisely, try `out_vec`
|
2017-02-07 21:05:30 +01:00
|
|
|
|
|
|
|
|
note: lint level defined here
|
|
|
|
--> $DIR/for_loop.rs:90:49
|
|
|
|
|
|
|
|
|
90 | #[deny(needless_range_loop, explicit_iter_loop, explicit_into_iter_loop, iter_next_loop, reverse_range_loop, explicit_counter_loop, for_kv_map)]
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
2017-02-21 12:13:44 +01:00
|
|
|
error: it is more idiomatic to loop over references to containers instead of using explicit iteration methods
|
|
|
|
--> $DIR/for_loop.rs:306:15
|
2017-02-07 21:05:30 +01:00
|
|
|
|
|
2017-02-21 12:13:44 +01:00
|
|
|
306 | for _v in array.into_iter() {}
|
2017-05-03 12:51:47 +02:00
|
|
|
| ^^^^^^^^^^^^^^^^^ help: to write this more concisely, try `&array`
|
2017-02-21 12:13:44 +01:00
|
|
|
|
|
|
|
error: it is more idiomatic to loop over references to containers instead of using explicit iteration methods
|
|
|
|
--> $DIR/for_loop.rs:311:15
|
|
|
|
|
|
|
|
|
311 | for _v in [1, 2, 3].iter() { }
|
2017-05-03 12:51:47 +02:00
|
|
|
| ^^^^^^^^^^^^^^^^ help: to write this more concisely, try `&[1, 2, 3]`
|
2017-02-07 21:05:30 +01:00
|
|
|
|
2017-02-21 12:13:44 +01:00
|
|
|
error: it is more idiomatic to loop over references to containers instead of using explicit iteration methods
|
|
|
|
--> $DIR/for_loop.rs:318:15
|
2017-02-07 21:05:30 +01:00
|
|
|
|
|
2017-02-21 12:13:44 +01:00
|
|
|
318 | for _v in [0; 32].iter() {}
|
2017-05-03 12:51:47 +02:00
|
|
|
| ^^^^^^^^^^^^^^ help: to write this more concisely, try `&[0; 32]`
|
2017-02-07 21:05:30 +01:00
|
|
|
|
2017-02-21 12:13:44 +01:00
|
|
|
error: it is more idiomatic to loop over references to containers instead of using explicit iteration methods
|
|
|
|
--> $DIR/for_loop.rs:326:15
|
2017-02-07 21:05:30 +01:00
|
|
|
|
|
2017-02-21 12:13:44 +01:00
|
|
|
326 | for _v in ll.iter() { }
|
2017-05-03 12:51:47 +02:00
|
|
|
| ^^^^^^^^^ help: to write this more concisely, try `&ll`
|
2017-02-07 21:05:30 +01:00
|
|
|
|
2017-02-21 12:13:44 +01:00
|
|
|
error: it is more idiomatic to loop over references to containers instead of using explicit iteration methods
|
|
|
|
--> $DIR/for_loop.rs:332:15
|
2017-02-07 21:05:30 +01:00
|
|
|
|
|
2017-02-21 12:13:44 +01:00
|
|
|
332 | for _v in vd.iter() { }
|
2017-05-03 12:51:47 +02:00
|
|
|
| ^^^^^^^^^ help: to write this more concisely, try `&vd`
|
2017-02-07 21:05:30 +01:00
|
|
|
|
2017-02-21 12:13:44 +01:00
|
|
|
error: it is more idiomatic to loop over references to containers instead of using explicit iteration methods
|
|
|
|
--> $DIR/for_loop.rs:338:15
|
2017-02-07 21:05:30 +01:00
|
|
|
|
|
2017-02-21 12:13:44 +01:00
|
|
|
338 | for _v in bh.iter() { }
|
2017-05-03 12:51:47 +02:00
|
|
|
| ^^^^^^^^^ help: to write this more concisely, try `&bh`
|
2017-02-07 21:05:30 +01:00
|
|
|
|
2017-02-21 12:13:44 +01:00
|
|
|
error: it is more idiomatic to loop over references to containers instead of using explicit iteration methods
|
|
|
|
--> $DIR/for_loop.rs:344:15
|
2017-02-07 21:05:30 +01:00
|
|
|
|
|
2017-02-21 12:13:44 +01:00
|
|
|
344 | for _v in hm.iter() { }
|
2017-05-03 12:51:47 +02:00
|
|
|
| ^^^^^^^^^ help: to write this more concisely, try `&hm`
|
2017-02-07 21:05:30 +01:00
|
|
|
|
2017-02-21 12:13:44 +01:00
|
|
|
error: it is more idiomatic to loop over references to containers instead of using explicit iteration methods
|
|
|
|
--> $DIR/for_loop.rs:350:15
|
2017-02-07 21:05:30 +01:00
|
|
|
|
|
2017-02-21 12:13:44 +01:00
|
|
|
350 | for _v in bt.iter() { }
|
2017-05-03 12:51:47 +02:00
|
|
|
| ^^^^^^^^^ help: to write this more concisely, try `&bt`
|
2017-02-07 21:05:30 +01:00
|
|
|
|
2017-02-21 12:13:44 +01:00
|
|
|
error: it is more idiomatic to loop over references to containers instead of using explicit iteration methods
|
|
|
|
--> $DIR/for_loop.rs:356:15
|
2017-02-07 21:05:30 +01:00
|
|
|
|
|
2017-02-21 12:13:44 +01:00
|
|
|
356 | for _v in hs.iter() { }
|
2017-05-03 12:51:47 +02:00
|
|
|
| ^^^^^^^^^ help: to write this more concisely, try `&hs`
|
2017-02-07 21:05:30 +01:00
|
|
|
|
2017-02-21 12:13:44 +01:00
|
|
|
error: it is more idiomatic to loop over references to containers instead of using explicit iteration methods
|
|
|
|
--> $DIR/for_loop.rs:362:15
|
2017-02-07 21:05:30 +01:00
|
|
|
|
|
2017-02-21 12:13:44 +01:00
|
|
|
362 | for _v in bs.iter() { }
|
2017-05-03 12:51:47 +02:00
|
|
|
| ^^^^^^^^^ help: to write this more concisely, try `&bs`
|
2017-02-07 21:05:30 +01:00
|
|
|
|
|
|
|
error: you are iterating over `Iterator::next()` which is an Option; this will compile but is probably not what you want
|
2017-02-21 12:13:44 +01:00
|
|
|
--> $DIR/for_loop.rs:368:5
|
2017-02-07 21:05:30 +01:00
|
|
|
|
|
2017-02-21 12:13:44 +01:00
|
|
|
368 | for _v in vec.iter().next() { }
|
2017-02-07 21:05:30 +01:00
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
|
note: lint level defined here
|
|
|
|
--> $DIR/for_loop.rs:90:74
|
|
|
|
|
|
|
|
|
90 | #[deny(needless_range_loop, explicit_iter_loop, explicit_into_iter_loop, iter_next_loop, reverse_range_loop, explicit_counter_loop, for_kv_map)]
|
|
|
|
| ^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
error: you are collect()ing an iterator and throwing away the result. Consider using an explicit for loop to exhaust the iterator
|
2017-02-21 12:13:44 +01:00
|
|
|
--> $DIR/for_loop.rs:375:5
|
2017-02-07 21:05:30 +01:00
|
|
|
|
|
2017-02-21 12:13:44 +01:00
|
|
|
375 | vec.iter().map(|x| out.push(x)).collect::<Vec<_>>();
|
2017-02-07 21:05:30 +01:00
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
|
note: lint level defined here
|
|
|
|
--> $DIR/for_loop.rs:91:8
|
|
|
|
|
|
|
|
|
91 | #[deny(unused_collect)]
|
|
|
|
| ^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
error: the variable `_index` is used as a loop counter. Consider using `for (_index, item) in &vec.enumerate()` or similar iterators
|
2017-02-21 12:13:44 +01:00
|
|
|
--> $DIR/for_loop.rs:380:5
|
2017-02-07 21:05:30 +01:00
|
|
|
|
|
2017-02-21 12:13:44 +01:00
|
|
|
380 | for _v in &vec { _index += 1 }
|
2017-02-07 21:05:30 +01:00
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
|
note: lint level defined here
|
|
|
|
--> $DIR/for_loop.rs:90:110
|
|
|
|
|
|
|
|
|
90 | #[deny(needless_range_loop, explicit_iter_loop, explicit_into_iter_loop, iter_next_loop, reverse_range_loop, explicit_counter_loop, for_kv_map)]
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
error: the variable `_index` is used as a loop counter. Consider using `for (_index, item) in &vec.enumerate()` or similar iterators
|
2017-02-21 12:13:44 +01:00
|
|
|
--> $DIR/for_loop.rs:384:5
|
2017-02-07 21:05:30 +01:00
|
|
|
|
|
2017-02-21 12:13:44 +01:00
|
|
|
384 | for _v in &vec { _index += 1 }
|
2017-02-07 21:05:30 +01:00
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
error: you seem to want to iterate on a map's values
|
2017-02-21 12:13:44 +01:00
|
|
|
--> $DIR/for_loop.rs:444:5
|
2017-02-07 21:05:30 +01:00
|
|
|
|
|
2017-04-23 15:25:22 +02:00
|
|
|
444 | / for (_, v) in &m {
|
2017-02-08 14:58:07 +01:00
|
|
|
445 | |
|
2017-02-21 12:13:44 +01:00
|
|
|
446 | |
|
|
|
|
447 | |
|
|
|
|
448 | |
|
|
|
|
449 | | let _v = v;
|
|
|
|
450 | | }
|
2017-04-23 15:25:22 +02:00
|
|
|
| |_____^
|
2017-02-07 21:05:30 +01:00
|
|
|
|
|
|
|
|
note: lint level defined here
|
|
|
|
--> $DIR/for_loop.rs:90:133
|
|
|
|
|
|
|
|
|
90 | #[deny(needless_range_loop, explicit_iter_loop, explicit_into_iter_loop, iter_next_loop, reverse_range_loop, explicit_counter_loop, for_kv_map)]
|
|
|
|
| ^^^^^^^^^^
|
|
|
|
help: use the corresponding method
|
|
|
|
| for v in m.values() {
|
|
|
|
|
|
|
|
error: you seem to want to iterate on a map's values
|
2017-02-21 12:13:44 +01:00
|
|
|
--> $DIR/for_loop.rs:453:5
|
2017-02-07 21:05:30 +01:00
|
|
|
|
|
2017-04-23 15:25:22 +02:00
|
|
|
453 | / for (_, v) in &*m {
|
2017-02-08 14:58:07 +01:00
|
|
|
454 | |
|
2017-02-21 12:13:44 +01:00
|
|
|
455 | |
|
|
|
|
456 | |
|
2017-04-10 15:36:07 +02:00
|
|
|
... |
|
2017-02-21 12:13:44 +01:00
|
|
|
460 | | // `in *m.values()` as we used to
|
|
|
|
461 | | }
|
2017-04-23 15:25:22 +02:00
|
|
|
| |_____^
|
2017-02-07 21:05:30 +01:00
|
|
|
|
|
|
|
|
help: use the corresponding method
|
|
|
|
| for v in (*m).values() {
|
|
|
|
|
|
|
|
error: you seem to want to iterate on a map's values
|
2017-02-21 12:13:44 +01:00
|
|
|
--> $DIR/for_loop.rs:464:5
|
2017-02-07 21:05:30 +01:00
|
|
|
|
|
2017-04-23 15:25:22 +02:00
|
|
|
464 | / for (_, v) in &mut m {
|
2017-02-08 14:58:07 +01:00
|
|
|
465 | |
|
2017-02-21 12:13:44 +01:00
|
|
|
466 | |
|
|
|
|
467 | |
|
|
|
|
468 | |
|
|
|
|
469 | | let _v = v;
|
|
|
|
470 | | }
|
2017-04-23 15:25:22 +02:00
|
|
|
| |_____^
|
2017-02-07 21:05:30 +01:00
|
|
|
|
|
|
|
|
help: use the corresponding method
|
|
|
|
| for v in m.values_mut() {
|
|
|
|
|
|
|
|
error: you seem to want to iterate on a map's values
|
2017-02-21 12:13:44 +01:00
|
|
|
--> $DIR/for_loop.rs:473:5
|
2017-02-07 21:05:30 +01:00
|
|
|
|
|
2017-04-23 15:25:22 +02:00
|
|
|
473 | / for (_, v) in &mut *m {
|
2017-02-08 14:58:07 +01:00
|
|
|
474 | |
|
2017-02-21 12:13:44 +01:00
|
|
|
475 | |
|
|
|
|
476 | |
|
|
|
|
477 | |
|
|
|
|
478 | | let _v = v;
|
|
|
|
479 | | }
|
2017-04-23 15:25:22 +02:00
|
|
|
| |_____^
|
2017-02-07 21:05:30 +01:00
|
|
|
|
|
|
|
|
help: use the corresponding method
|
|
|
|
| for v in (*m).values_mut() {
|
|
|
|
|
|
|
|
error: you seem to want to iterate on a map's keys
|
2017-02-21 12:13:44 +01:00
|
|
|
--> $DIR/for_loop.rs:483:5
|
2017-02-07 21:05:30 +01:00
|
|
|
|
|
2017-04-23 15:25:22 +02:00
|
|
|
483 | / for (k, _value) in rm {
|
2017-02-08 14:58:07 +01:00
|
|
|
484 | |
|
2017-02-21 12:13:44 +01:00
|
|
|
485 | |
|
|
|
|
486 | |
|
|
|
|
487 | |
|
|
|
|
488 | | let _k = k;
|
|
|
|
489 | | }
|
2017-04-23 15:25:22 +02:00
|
|
|
| |_____^
|
2017-02-07 21:05:30 +01:00
|
|
|
|
|
|
|
|
help: use the corresponding method
|
|
|
|
| for k in rm.keys() {
|
|
|
|
|
2017-02-21 12:13:44 +01:00
|
|
|
error: aborting due to 48 previous errors
|
2017-02-07 21:05:30 +01:00
|
|
|
|