Skip to content

Commit 38d0b21

Browse files
author
Michael Wright
committed
Correct iterator_step_by_zero documentation
1 parent e097fca commit 38d0b21

File tree

1 file changed

+6
-7
lines changed
  • clippy_lints/src/methods

1 file changed

+6
-7
lines changed

clippy_lints/src/methods/mod.rs

+6-7
Original file line numberDiff line numberDiff line change
@@ -738,18 +738,17 @@ declare_clippy_lint! {
738738
}
739739

740740
declare_clippy_lint! {
741-
/// **What it does:** Checks for calling `.step_by(0)` on iterators,
742-
/// which never terminates.
741+
/// **What it does:** Checks for calling `.step_by(0)` on iterators which panics.
743742
///
744-
/// **Why is this bad?** This very much looks like an oversight, since with
745-
/// `loop { .. }` there is an obvious better way to endlessly loop.
743+
/// **Why is this bad?** This very much looks like an oversight. Use `panic!()` instead if you
744+
/// actually intend to panic.
746745
///
747746
/// **Known problems:** None.
748747
///
749748
/// **Example:**
750-
/// ```ignore
751-
/// for x in (5..5).step_by(0) {
752-
/// ..
749+
/// ```should_panic
750+
/// for x in (0..100).step_by(0) {
751+
/// //..
753752
/// }
754753
/// ```
755754
pub ITERATOR_STEP_BY_ZERO,

0 commit comments

Comments
 (0)