mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-16 01:38:09 +00:00
e097fca4df
Move `iterator_step_by_zero` into `methods` since it applies to all iterators and not just ranges. Simplify the code while doing so.
46 lines
1.3 KiB
Text
46 lines
1.3 KiB
Text
error: Iterator::step_by(0) will panic at runtime
|
|
--> $DIR/iterator_step_by_zero.rs:3:13
|
|
|
|
|
LL | let _ = vec!["A", "B", "B"].iter().step_by(0);
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
= note: `-D clippy::iterator-step-by-zero` implied by `-D warnings`
|
|
|
|
error: Iterator::step_by(0) will panic at runtime
|
|
--> $DIR/iterator_step_by_zero.rs:4:13
|
|
|
|
|
LL | let _ = "XXX".chars().step_by(0);
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
error: Iterator::step_by(0) will panic at runtime
|
|
--> $DIR/iterator_step_by_zero.rs:5:13
|
|
|
|
|
LL | let _ = (0..1).step_by(0);
|
|
| ^^^^^^^^^^^^^^^^^
|
|
|
|
error: Iterator::step_by(0) will panic at runtime
|
|
--> $DIR/iterator_step_by_zero.rs:14:13
|
|
|
|
|
LL | let _ = (1..).step_by(0);
|
|
| ^^^^^^^^^^^^^^^^
|
|
|
|
error: Iterator::step_by(0) will panic at runtime
|
|
--> $DIR/iterator_step_by_zero.rs:15:13
|
|
|
|
|
LL | let _ = (1..=2).step_by(0);
|
|
| ^^^^^^^^^^^^^^^^^^
|
|
|
|
error: Iterator::step_by(0) will panic at runtime
|
|
--> $DIR/iterator_step_by_zero.rs:18:13
|
|
|
|
|
LL | let _ = x.step_by(0);
|
|
| ^^^^^^^^^^^^
|
|
|
|
error: Iterator::step_by(0) will panic at runtime
|
|
--> $DIR/iterator_step_by_zero.rs:22:13
|
|
|
|
|
LL | let _ = v1.iter().step_by(2 / 3);
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
error: aborting due to 7 previous errors
|
|
|