54 lines
912 B
Plaintext
54 lines
912 B
Plaintext
![]() |
== Why is this an issue?
|
||
|
|
||
|
include::../description.adoc[]
|
||
|
|
||
|
=== Noncompliant code example
|
||
|
|
||
|
[source,rust,diff-id=1,diff-type=noncompliant]
|
||
|
----
|
||
|
if param == 1 {
|
||
|
openWindow();
|
||
|
} else if param == 2 {
|
||
|
closeWindow();
|
||
|
} else if param == 1 { // Noncompliant
|
||
|
moveWindowToTheBackground();
|
||
|
}
|
||
|
----
|
||
|
|
||
|
=== Compliant solution
|
||
|
|
||
|
[source,rust,diff-id=1,diff-type=compliant]
|
||
|
----
|
||
|
if param == 1 {
|
||
|
openWindow();
|
||
|
} else if param == 2 {
|
||
|
closeWindow();
|
||
|
} else if param == 3 {
|
||
|
moveWindowToTheBackground();
|
||
|
}
|
||
|
----
|
||
|
|
||
|
== Resources
|
||
|
|
||
|
=== Documentation
|
||
|
|
||
|
* Clippy Lints - https://rust-lang.github.io/rust-clippy/master/index.html#ifs_same_cond
|
||
|
|
||
|
ifdef::env-github,rspecator-view[]
|
||
|
|
||
|
'''
|
||
|
== Implementation Specification
|
||
|
(visible only on this page)
|
||
|
|
||
|
include::../message.adoc[]
|
||
|
|
||
|
include::../highlighting.adoc[]
|
||
|
|
||
|
'''
|
||
|
== Comments And Links
|
||
|
(visible only on this page)
|
||
|
|
||
|
include::../comments-and-links.adoc[]
|
||
|
|
||
|
endif::env-github,rspecator-view[]
|