Reports when a return keyword is used inside an anonymous function to jump out of it early.
Nonlocal returns are implemented by throwing and catching scala.runtime.NonLocalReturnException-s.
This is rarely what is intended by the programmer. It can be problematic because of the hidden performance cost of
throwing and catching exceptions.
Furthermore, it is a leaky implementation: a catch-all exception handler can intercept a NonLocalReturnException.
def foo(numbers: Seq[Int]): Int =
numbers.map { n =>
if (n > 5)
return 0 // highlighted
n * 2
}.sum