35 lines
479 B
Plaintext
35 lines
479 B
Plaintext
== Why is this an issue?
|
|
|
|
include::../description.adoc[]
|
|
|
|
=== Noncompliant code example
|
|
|
|
[source,rust,diff-id=1,diff-type=noncompliant]
|
|
----
|
|
let mut x = 0;
|
|
loop {
|
|
x += 1;
|
|
if x == 1 {
|
|
return;
|
|
}
|
|
break;
|
|
}
|
|
----
|
|
|
|
=== Compliant solution
|
|
|
|
[source,rust,diff-id=1,diff-type=compliant]
|
|
----
|
|
let mut x = 0;
|
|
x += 1;
|
|
if x == 1 {
|
|
return;
|
|
}
|
|
----
|
|
|
|
== Resources
|
|
|
|
=== Documentation
|
|
|
|
* Clippy Lints - https://rust-lang.github.io/rust-clippy/master/index.html#never_loop
|