rspec/rules/S2957/swift/rule.adoc
Fred Tingaud 16f6c0aecf
Inline adoc when include has no additional value (#1940)
Inline adoc files when they are included exactly once.

Also fix language tags because this inlining gives us better information
on what language the code is written in.
2023-05-25 14:18:12 +02:00

49 lines
1.0 KiB
Plaintext

== Why is this an issue?
When a closure contains only a ``++return++`` statement, the ``++return++`` itself can be omitted.
=== Noncompliant code example
[source,swift]
----
someList.sort { a, b in
return a > b
}
----
=== Compliant solution
[source,swift]
----
someList.sort { a, b in a > b }
----
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
=== Message
Remove the "return" keyword.
'''
== Comments And Links
(visible only on this page)
=== on 20 May 2015, 18:13:45 Ann Campbell wrote:
\[~elena.vilchik] I suspect a standard "for greater readability" argument is expected here, but it's hard for me to make it. Feel free to add it yourself. :-)
=== on 21 May 2015, 07:13:19 Elena Vilchik wrote:
\[~ann.campbell.2] what do you mean "argument"? Anyway I looks good to me now :)
=== on 3 Feb 2016, 17:11:53 Ann Campbell wrote:
\[~elena.vilchik] I just now saw your response (doh!). In this case "argument" == "reason".
endif::env-github,rspecator-view[]