RedundantSyntax
This rule removes redundant syntax.
Configuration
By default, this rule rewrites any syntax known as redundant.
Defaults
RedundantSyntax.finalObject = true
RedundantSyntax.stringInterpolator = true
Features
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")