You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
➜ ~/scala-snippets-6 scala-cli -Ywarn-unused -S 2.13 warning_lamdas.scala
[warn] ./warning_lamdas.scala:3:34
[warn] parameter x in anonymous function is never used
[warn] def f(): Unit = Option(1).map((x: Int) => dummy)
I know I encountered this while enabling lints on the scala 2 code base. Sorry I don't have a link, but I'll add it if I find it.
I think my conclusion was, "naming is hard, avoid it if you can."
xs.map((_: Int) => f) // let's say the type is required
Since naming is a cost (like anything else), penalize it!
"If you name it, use it!"
If Scala had a mascot, Scala Center could commission a poster showing the mascot with that slogan. Like Smokey Bear saying only you can prevent forest fires.
In Scala 2.13:
In Scala 3, no warning.
Might be due to #17223.
The text was updated successfully, but these errors were encountered: