2021-01-27 13:42:22 +01:00
|
|
|
Return of boolean literal statements wrapped into ``++if-then-else++`` ones should be simplified.
|
2020-06-30 12:47:33 +02:00
|
|
|
|
2021-02-02 15:02:10 +01:00
|
|
|
|
2020-06-30 12:47:33 +02:00
|
|
|
Note that if the result of the expression is not a boolean but for instance an integer, then double negation should be used for proper conversion.
|
|
|
|
|
|
|
|
include::../noncompliant.adoc[]
|
|
|
|
|
|
|
|
== Compliant Solution
|
|
|
|
|
|
|
|
----
|
|
|
|
return expression;
|
|
|
|
----
|
|
|
|
or
|
2020-06-30 14:49:38 +02:00
|
|
|
|
2020-06-30 12:47:33 +02:00
|
|
|
----
|
|
|
|
return !!expression;
|
|
|
|
----
|
2021-06-02 20:44:38 +02:00
|
|
|
|
|
|
|
ifdef::rspecator-view[]
|
|
|
|
== Comments And Links
|
|
|
|
(visible only on this page)
|
|
|
|
|
|
|
|
include::../comments-and-links.adoc[]
|
|
|
|
endif::rspecator-view[]
|