RedundantSyntax
This rule removes redundant syntax.
final
keyword on an object
- final object foo
+ object Foo
Note: in Scala 2.12 and earlier removing the final
modifier will slightly change the resulting bytecode -
see this bug ticket for further information.
String interpolators
RedundantSyntax
removes unnecessary string interpolators.
Only out-of-the-box interpolators (s
, f
and raw
) are supported.
Example:
- println(s"Foo")
+ println("Foo")
- println(f"Bar")
+ println("Bar")
- println(raw"Baz")
+ println("Baz")
// No change as `raw` is not redundant.
println(raw"Foo\nBar")