Scala

Scala

Made by DeepSource

Lambda parameter is unused SC-W1083

Bug risk
Major

Lambda expressions are anonymous functions that are not bound to any particular identifier and are extensively used in the standard and 3rd party libraries for operations such as filter, map, count, etc. These expressions may take in one or more parameters just like normal methods. However, in this case, one of the parameters that the lambda depends on is unused. Either you meant to consume the said parameter or that the parameter is simply not required by design and can be omitted.

Bad Practice

elems.filter(x => true)

Recommended

elems.filter(x => x >= lower && x <= upper)