530 lines
17 KiB
Plaintext
530 lines
17 KiB
Plaintext
error: for loop over `option`, which is an `Option`. This is more readably written as an `if let` statement.
|
|
--> for_loop.rs:17:14
|
|
|
|
|
17 | for x in option {
|
|
| ^^^^^^
|
|
|
|
|
= note: `-D for-loop-over-option` implied by `-D warnings`
|
|
= 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.
|
|
--> for_loop.rs:22:14
|
|
|
|
|
22 | for x in result {
|
|
| ^^^^^^
|
|
|
|
|
= note: `-D for-loop-over-result` implied by `-D warnings`
|
|
= 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.
|
|
--> for_loop.rs:26:14
|
|
|
|
|
26 | for x in option.ok_or("x not found") {
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
= note: `-D for-loop-over-result` implied by `-D warnings`
|
|
= 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
|
|
--> for_loop.rs:31:5
|
|
|
|
|
31 | / for x in v.iter().next() {
|
|
32 | | println!("{}", x);
|
|
33 | | }
|
|
| |_____^
|
|
|
|
|
= note: `-D iter-next-loop` implied by `-D warnings`
|
|
|
|
error: for loop over `v.iter().next().and(Some(0))`, which is an `Option`. This is more readably written as an `if let` statement.
|
|
--> for_loop.rs:36:14
|
|
|
|
|
36 | for x in v.iter().next().and(Some(0)) {
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
= note: `-D for-loop-over-option` implied by `-D warnings`
|
|
= 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.
|
|
--> for_loop.rs:40:14
|
|
|
|
|
40 | for x in v.iter().next().ok_or("x not found") {
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
= note: `-D for-loop-over-result` implied by `-D warnings`
|
|
= 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: this loop never actually loops
|
|
--> for_loop.rs:52:5
|
|
|
|
|
52 | / while let Some(x) = option {
|
|
53 | | println!("{}", x);
|
|
54 | | break;
|
|
55 | | }
|
|
| |_____^
|
|
|
|
|
= note: `-D never-loop` implied by `-D warnings`
|
|
|
|
error: this loop never actually loops
|
|
--> for_loop.rs:58:5
|
|
|
|
|
58 | / while let Ok(x) = result {
|
|
59 | | println!("{}", x);
|
|
60 | | break;
|
|
61 | | }
|
|
| |_____^
|
|
|
|
|
= note: `-D never-loop` implied by `-D warnings`
|
|
|
|
error: the loop variable `i` is only used to index `vec`.
|
|
--> for_loop.rs:84:5
|
|
|
|
|
84 | / for i in 0..vec.len() {
|
|
85 | | println!("{}", vec[i]);
|
|
86 | | }
|
|
| |_____^
|
|
|
|
|
= note: `-D needless-range-loop` implied by `-D warnings`
|
|
help: consider using an iterator
|
|
| for <item> in &vec {
|
|
|
|
error: unused variable: `i`
|
|
--> for_loop.rs:88:9
|
|
|
|
|
88 | for i in 0..vec.len() {
|
|
| ^
|
|
|
|
|
= note: `-D unused-variables` implied by `-D warnings`
|
|
|
|
error: the loop variable `i` is only used to index `vec`.
|
|
--> for_loop.rs:93:5
|
|
|
|
|
93 | for i in 0..vec.len() { let _ = vec[i]; }
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
= note: `-D needless-range-loop` implied by `-D warnings`
|
|
help: consider using an iterator
|
|
| for <item> in &vec { let _ = vec[i]; }
|
|
|
|
error: the loop variable `j` is only used to index `STATIC`.
|
|
--> for_loop.rs:96:5
|
|
|
|
|
96 | / for j in 0..4 {
|
|
97 | | println!("{:?}", STATIC[j]);
|
|
98 | | }
|
|
| |_____^
|
|
|
|
|
= note: `-D needless-range-loop` implied by `-D warnings`
|
|
help: consider using an iterator
|
|
| for <item> in STATIC.iter().take(4) {
|
|
|
|
error: the loop variable `j` is only used to index `CONST`.
|
|
--> for_loop.rs:100:5
|
|
|
|
|
100 | / for j in 0..4 {
|
|
101 | | println!("{:?}", CONST[j]);
|
|
102 | | }
|
|
| |_____^
|
|
|
|
|
= note: `-D needless-range-loop` implied by `-D warnings`
|
|
help: consider using an iterator
|
|
| for <item> in CONST.iter().take(4) {
|
|
|
|
error: the loop variable `i` is used to index `vec`
|
|
--> for_loop.rs:104:5
|
|
|
|
|
104 | / for i in 0..vec.len() {
|
|
105 | | println!("{} {}", vec[i], i);
|
|
106 | | }
|
|
| |_____^
|
|
|
|
|
= note: `-D needless-range-loop` implied by `-D warnings`
|
|
help: consider using an iterator
|
|
| for (i, <item>) in vec.iter().enumerate() {
|
|
|
|
error: the loop variable `i` is only used to index `vec2`.
|
|
--> for_loop.rs:111:5
|
|
|
|
|
111 | / for i in 0..vec.len() {
|
|
112 | | println!("{}", vec2[i]);
|
|
113 | | }
|
|
| |_____^
|
|
|
|
|
= note: `-D needless-range-loop` implied by `-D warnings`
|
|
help: consider using an iterator
|
|
| for <item> in vec2.iter().take(vec.len()) {
|
|
|
|
error: the loop variable `i` is only used to index `vec`.
|
|
--> for_loop.rs:115:5
|
|
|
|
|
115 | / for i in 5..vec.len() {
|
|
116 | | println!("{}", vec[i]);
|
|
117 | | }
|
|
| |_____^
|
|
|
|
|
= note: `-D needless-range-loop` implied by `-D warnings`
|
|
help: consider using an iterator
|
|
| for <item> in vec.iter().skip(5) {
|
|
|
|
error: the loop variable `i` is only used to index `vec`.
|
|
--> for_loop.rs:119:5
|
|
|
|
|
119 | / for i in 0..MAX_LEN {
|
|
120 | | println!("{}", vec[i]);
|
|
121 | | }
|
|
| |_____^
|
|
|
|
|
= note: `-D needless-range-loop` implied by `-D warnings`
|
|
help: consider using an iterator
|
|
| for <item> in vec.iter().take(MAX_LEN) {
|
|
|
|
error: the loop variable `i` is only used to index `vec`.
|
|
--> for_loop.rs:123:5
|
|
|
|
|
123 | / for i in 0...MAX_LEN {
|
|
124 | | println!("{}", vec[i]);
|
|
125 | | }
|
|
| |_____^
|
|
|
|
|
= note: `-D needless-range-loop` implied by `-D warnings`
|
|
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`.
|
|
--> for_loop.rs:127:5
|
|
|
|
|
127 | / for i in 5..10 {
|
|
128 | | println!("{}", vec[i]);
|
|
129 | | }
|
|
| |_____^
|
|
|
|
|
= note: `-D needless-range-loop` implied by `-D warnings`
|
|
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`.
|
|
--> for_loop.rs:131:5
|
|
|
|
|
131 | / for i in 5...10 {
|
|
132 | | println!("{}", vec[i]);
|
|
133 | | }
|
|
| |_____^
|
|
|
|
|
= note: `-D needless-range-loop` implied by `-D warnings`
|
|
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`
|
|
--> for_loop.rs:135:5
|
|
|
|
|
135 | / for i in 5..vec.len() {
|
|
136 | | println!("{} {}", vec[i], i);
|
|
137 | | }
|
|
| |_____^
|
|
|
|
|
= note: `-D needless-range-loop` implied by `-D warnings`
|
|
help: consider using an iterator
|
|
| for (i, <item>) in vec.iter().enumerate().skip(5) {
|
|
|
|
error: the loop variable `i` is used to index `vec`
|
|
--> for_loop.rs:139:5
|
|
|
|
|
139 | / for i in 5..10 {
|
|
140 | | println!("{} {}", vec[i], i);
|
|
141 | | }
|
|
| |_____^
|
|
|
|
|
= note: `-D needless-range-loop` implied by `-D warnings`
|
|
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
|
|
--> for_loop.rs:143:5
|
|
|
|
|
143 | / for i in 10..0 {
|
|
144 | | println!("{}", i);
|
|
145 | | }
|
|
| |_____^
|
|
|
|
|
= note: `-D reverse-range-loop` implied by `-D warnings`
|
|
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
|
|
--> for_loop.rs:147:5
|
|
|
|
|
147 | / for i in 10...0 {
|
|
148 | | println!("{}", i);
|
|
149 | | }
|
|
| |_____^
|
|
|
|
|
= note: `-D reverse-range-loop` implied by `-D warnings`
|
|
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
|
|
--> for_loop.rs:151:5
|
|
|
|
|
151 | / for i in MAX_LEN..0 {
|
|
152 | | println!("{}", i);
|
|
153 | | }
|
|
| |_____^
|
|
|
|
|
= note: `-D reverse-range-loop` implied by `-D warnings`
|
|
help: consider using the following if you are attempting to iterate over this range in reverse
|
|
| for i in (0..MAX_LEN).rev() {
|
|
|
|
error: this range is empty so this for loop will never run
|
|
--> for_loop.rs:155:5
|
|
|
|
|
155 | / for i in 5..5 {
|
|
156 | | println!("{}", i);
|
|
157 | | }
|
|
| |_____^
|
|
|
|
|
= note: `-D reverse-range-loop` implied by `-D warnings`
|
|
|
|
error: this range is empty so this for loop will never run
|
|
--> for_loop.rs:176:5
|
|
|
|
|
176 | / for i in 10..5+4 {
|
|
177 | | println!("{}", i);
|
|
178 | | }
|
|
| |_____^
|
|
|
|
|
= note: `-D reverse-range-loop` implied by `-D warnings`
|
|
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
|
|
--> for_loop.rs:180:5
|
|
|
|
|
180 | / for i in (5+2)..(3-1) {
|
|
181 | | println!("{}", i);
|
|
182 | | }
|
|
| |_____^
|
|
|
|
|
= note: `-D reverse-range-loop` implied by `-D warnings`
|
|
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
|
|
--> for_loop.rs:184:5
|
|
|
|
|
184 | / for i in (5+2)..(8-1) {
|
|
185 | | println!("{}", i);
|
|
186 | | }
|
|
| |_____^
|
|
|
|
|
= note: `-D reverse-range-loop` implied by `-D warnings`
|
|
|
|
error: use of deprecated item: replaced by `Iterator::step_by`
|
|
--> for_loop.rs:192:22
|
|
|
|
|
192 | for i in (10..8).step_by(-1) {
|
|
| ^^^^^^^
|
|
|
|
|
= note: `-D deprecated` implied by `-D warnings`
|
|
|
|
error: it is more idiomatic to loop over references to containers instead of using explicit iteration methods
|
|
--> for_loop.rs:207:15
|
|
|
|
|
207 | for _v in vec.iter() { }
|
|
| ^^^^^^^^^^ help: to write this more concisely, try `&vec`
|
|
|
|
|
= note: `-D explicit-iter-loop` implied by `-D warnings`
|
|
|
|
error: it is more idiomatic to loop over references to containers instead of using explicit iteration methods
|
|
--> for_loop.rs:209:15
|
|
|
|
|
209 | for _v in vec.iter_mut() { }
|
|
| ^^^^^^^^^^^^^^ help: to write this more concisely, try `&mut vec`
|
|
|
|
|
= note: `-D explicit-iter-loop` implied by `-D warnings`
|
|
|
|
error: it is more idiomatic to loop over containers instead of using explicit iteration methods`
|
|
--> for_loop.rs:212:15
|
|
|
|
|
212 | for _v in out_vec.into_iter() { }
|
|
| ^^^^^^^^^^^^^^^^^^^ help: to write this more concisely, try `out_vec`
|
|
|
|
|
= note: `-D explicit-into-iter-loop` implied by `-D warnings`
|
|
|
|
error: it is more idiomatic to loop over references to containers instead of using explicit iteration methods
|
|
--> for_loop.rs:215:15
|
|
|
|
|
215 | for _v in array.into_iter() {}
|
|
| ^^^^^^^^^^^^^^^^^ help: to write this more concisely, try `&array`
|
|
|
|
|
= note: `-D explicit-iter-loop` implied by `-D warnings`
|
|
|
|
error: it is more idiomatic to loop over references to containers instead of using explicit iteration methods
|
|
--> for_loop.rs:220:15
|
|
|
|
|
220 | for _v in [1, 2, 3].iter() { }
|
|
| ^^^^^^^^^^^^^^^^ help: to write this more concisely, try `&[1, 2, 3]`
|
|
|
|
|
= note: `-D explicit-iter-loop` implied by `-D warnings`
|
|
|
|
error: it is more idiomatic to loop over references to containers instead of using explicit iteration methods
|
|
--> for_loop.rs:224:15
|
|
|
|
|
224 | for _v in [0; 32].iter() {}
|
|
| ^^^^^^^^^^^^^^ help: to write this more concisely, try `&[0; 32]`
|
|
|
|
|
= note: `-D explicit-iter-loop` implied by `-D warnings`
|
|
|
|
error: it is more idiomatic to loop over references to containers instead of using explicit iteration methods
|
|
--> for_loop.rs:229:15
|
|
|
|
|
229 | for _v in ll.iter() { }
|
|
| ^^^^^^^^^ help: to write this more concisely, try `&ll`
|
|
|
|
|
= note: `-D explicit-iter-loop` implied by `-D warnings`
|
|
|
|
error: it is more idiomatic to loop over references to containers instead of using explicit iteration methods
|
|
--> for_loop.rs:232:15
|
|
|
|
|
232 | for _v in vd.iter() { }
|
|
| ^^^^^^^^^ help: to write this more concisely, try `&vd`
|
|
|
|
|
= note: `-D explicit-iter-loop` implied by `-D warnings`
|
|
|
|
error: it is more idiomatic to loop over references to containers instead of using explicit iteration methods
|
|
--> for_loop.rs:235:15
|
|
|
|
|
235 | for _v in bh.iter() { }
|
|
| ^^^^^^^^^ help: to write this more concisely, try `&bh`
|
|
|
|
|
= note: `-D explicit-iter-loop` implied by `-D warnings`
|
|
|
|
error: it is more idiomatic to loop over references to containers instead of using explicit iteration methods
|
|
--> for_loop.rs:238:15
|
|
|
|
|
238 | for _v in hm.iter() { }
|
|
| ^^^^^^^^^ help: to write this more concisely, try `&hm`
|
|
|
|
|
= note: `-D explicit-iter-loop` implied by `-D warnings`
|
|
|
|
error: it is more idiomatic to loop over references to containers instead of using explicit iteration methods
|
|
--> for_loop.rs:241:15
|
|
|
|
|
241 | for _v in bt.iter() { }
|
|
| ^^^^^^^^^ help: to write this more concisely, try `&bt`
|
|
|
|
|
= note: `-D explicit-iter-loop` implied by `-D warnings`
|
|
|
|
error: it is more idiomatic to loop over references to containers instead of using explicit iteration methods
|
|
--> for_loop.rs:244:15
|
|
|
|
|
244 | for _v in hs.iter() { }
|
|
| ^^^^^^^^^ help: to write this more concisely, try `&hs`
|
|
|
|
|
= note: `-D explicit-iter-loop` implied by `-D warnings`
|
|
|
|
error: it is more idiomatic to loop over references to containers instead of using explicit iteration methods
|
|
--> for_loop.rs:247:15
|
|
|
|
|
247 | for _v in bs.iter() { }
|
|
| ^^^^^^^^^ help: to write this more concisely, try `&bs`
|
|
|
|
|
= note: `-D explicit-iter-loop` implied by `-D warnings`
|
|
|
|
error: you are iterating over `Iterator::next()` which is an Option; this will compile but is probably not what you want
|
|
--> for_loop.rs:249:5
|
|
|
|
|
249 | for _v in vec.iter().next() { }
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
= note: `-D iter-next-loop` implied by `-D warnings`
|
|
|
|
error: you are collect()ing an iterator and throwing away the result. Consider using an explicit for loop to exhaust the iterator
|
|
--> for_loop.rs:256:5
|
|
|
|
|
256 | vec.iter().map(|x| out.push(x)).collect::<Vec<_>>();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
= note: `-D unused-collect` implied by `-D warnings`
|
|
|
|
error: the variable `_index` is used as a loop counter. Consider using `for (_index, item) in &vec.enumerate()` or similar iterators
|
|
--> for_loop.rs:261:5
|
|
|
|
|
261 | for _v in &vec { _index += 1 }
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
= note: `-D explicit-counter-loop` implied by `-D warnings`
|
|
|
|
error: the variable `_index` is used as a loop counter. Consider using `for (_index, item) in &vec.enumerate()` or similar iterators
|
|
--> for_loop.rs:265:5
|
|
|
|
|
265 | for _v in &vec { _index += 1 }
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
= note: `-D explicit-counter-loop` implied by `-D warnings`
|
|
|
|
error: you seem to want to iterate on a map's values
|
|
--> for_loop.rs:325:5
|
|
|
|
|
325 | / for (_, v) in &m {
|
|
326 | | let _v = v;
|
|
327 | | }
|
|
| |_____^
|
|
|
|
|
= note: `-D for-kv-map` implied by `-D warnings`
|
|
help: use the corresponding method
|
|
| for v in m.values() {
|
|
|
|
error: you seem to want to iterate on a map's values
|
|
--> for_loop.rs:330:5
|
|
|
|
|
330 | / for (_, v) in &*m {
|
|
331 | | let _v = v;
|
|
332 | | // Here the `*` is not actually necesarry, but the test tests that we don't suggest
|
|
333 | | // `in *m.values()` as we used to
|
|
334 | | }
|
|
| |_____^
|
|
|
|
|
= note: `-D for-kv-map` implied by `-D warnings`
|
|
help: use the corresponding method
|
|
| for v in (*m).values() {
|
|
|
|
error: you seem to want to iterate on a map's values
|
|
--> for_loop.rs:337:5
|
|
|
|
|
337 | / for (_, v) in &mut m {
|
|
338 | | let _v = v;
|
|
339 | | }
|
|
| |_____^
|
|
|
|
|
= note: `-D for-kv-map` implied by `-D warnings`
|
|
help: use the corresponding method
|
|
| for v in m.values_mut() {
|
|
|
|
error: you seem to want to iterate on a map's values
|
|
--> for_loop.rs:342:5
|
|
|
|
|
342 | / for (_, v) in &mut *m {
|
|
343 | | let _v = v;
|
|
344 | | }
|
|
| |_____^
|
|
|
|
|
= note: `-D for-kv-map` implied by `-D warnings`
|
|
help: use the corresponding method
|
|
| for v in (*m).values_mut() {
|
|
|
|
error: you seem to want to iterate on a map's keys
|
|
--> for_loop.rs:348:5
|
|
|
|
|
348 | / for (k, _value) in rm {
|
|
349 | | let _k = k;
|
|
350 | | }
|
|
| |_____^
|
|
|
|
|
= note: `-D for-kv-map` implied by `-D warnings`
|
|
help: use the corresponding method
|
|
| for k in rm.keys() {
|
|
|
|
error: aborting due to previous error(s)
|
|
|
|
|
|
To learn more, run the command again with --verbose.
|