Compare commits
2 Commits
master
...
rule/S1751
Author | SHA1 | Date | |
---|---|---|---|
![]() |
d23e6f1e6f | ||
![]() |
7bac0febbf |
7
rules/S1751/rust/metadata.json
Normal file
7
rules/S1751/rust/metadata.json
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
"tags": [
|
||||
"confusing",
|
||||
"bad-practice",
|
||||
"clippy"
|
||||
]
|
||||
}
|
34
rules/S1751/rust/rule.adoc
Normal file
34
rules/S1751/rust/rule.adoc
Normal file
@ -0,0 +1,34 @@
|
||||
== 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
|
Loading…
x
Reference in New Issue
Block a user