rspec/rules/S1751/rust/rule.adoc
yassin-kammoun-sonarsource d23e6f1e6f Update RSPEC
2025-03-25 13:36:48 +01:00

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