Update rule.adoc

This commit is contained in:
Gyula Sallai 2025-03-26 13:52:31 +01:00 committed by GitHub
parent 0b08f51c46
commit 4881d94421
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,44 +1,28 @@
FIXME: add a description
// If you want to factorize the description uncomment the following line and create the file.
//include::../description.adoc[]
== 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.
FIXME: remove the unused optional headers (that are commented out)
//=== What is the potential impact?
== How to fix it
//== How to fix it in FRAMEWORK NAME
=== Code examples
==== Noncompliant code example
[source,rust,diff-id=1,diff-type=noncompliant]
----
FIXME
for x in (0..100).step_by(0) { // Noncompliant: This will cause a panic.
// ...
}
----
==== Compliant solution
[source,rust,diff-id=1,diff-type=compliant]
----
FIXME
for x in (0..100).step_by(1) { // Compliant: Step by a valid positive integer.
// ...
}
----
//=== How does this work?
== Resources
=== Documentation
//=== Pitfalls
//=== Going the extra mile
//== Resources
//=== Documentation
//=== Articles & blog posts
//=== Conference presentations
//=== Standards
//=== External coding guidelines
//=== Benchmarks
* Clippy Lints - https://rust-lang.github.io/rust-clippy/master/index.html#iterator_step_by_zero