It is a best practice to make lambda return types implicit. First and foremost, doing so avoids implicit conversions which could result in data or precision loss. Second, omitting the return type helps future-proof the code.


== Noncompliant Code Example

----
[](int i) -> int // Noncompliant
{ return i + 42; } 
----


== Compliant Solution

----
[](int i) 
{ return i + 42; } 
----


