Scala

Scala

Made by DeepSource

Missing method return type SC-W1009

Bug risk
Major

Not specifying the return type of a method is part of the procedural syntax and is deprecated. In such cases, the compiler assumes that the return type of such method is Unit. Any explicit return statements inside such methods have no effect and are discarded.

Bad Practice

def foo() {
  return 1 // This return statement has no effect!
}

foo() // returns nothing!

Recommended

def foo(): Int = {
  return 1
}