Why is this an issue?

Calling .step_by(0) on an iterator will cause the program to panic. This is likely an oversight and should be corrected to ensure program stability. If the intent is to cause a panic, it is clearer to use panic!() directly.

Code examples

Noncompliant code example

for x in (0..100).step_by(0) { // Noncompliant: This will cause a panic.
// ...
}

Compliant solution

for x in (0..100).step_by(1) { // Compliant: Step by a valid positive integer.
// ...
}

Resources

Documentation