Skip to content

Commit 4f1321b

Browse files
authored
Merge pull request scalacenter#2254 from eejbyfeldt/support-wall-in-remove-unused
Add -Wall as supported flag for RemoveUnused
2 parents 56c915a + 6a2c597 commit 4f1321b

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

docs/rules/RemoveUnused.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ example diff from running `sbt "scalafix RemoveUnused"`.
1515
To use this rule:
1616

1717
- Enable the Scala compiler option `-Ywarn-unused` (2.12), `-Wunused` (2.13),
18-
or `-Wunused:all` (3.3.4+).
18+
`-Wunused:all` (3.3.4+), or -Wall (with 3.5.2+ and backported to 3.3.5+).
1919
- Disable `-Xfatal-warnings` if you have it enabled. This is required so the
2020
compiler warnings do not fail the build before running Scalafix. If you are
2121
running 2.12.13+ or 2.13.2+, you may keep `-Xfatal-warnings` by modifying how

scalafix-rules/src/main/scala/scalafix/internal/rule/OrganizeImports.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -870,7 +870,7 @@ object OrganizeImports {
870870

871871
val hasWarnUnused = hasCompilerSupport && {
872872
val warnUnusedPrefix = Set("-Wunused", "-Ywarn-unused")
873-
val warnUnusedString = Set("-Xlint", "-Xlint:unused")
873+
val warnUnusedString = Set("-Wall", "-Xlint", "-Xlint:unused")
874874
scalacOptions exists { option =>
875875
(warnUnusedPrefix exists option.startsWith) || (warnUnusedString contains option)
876876
}

scalafix-rules/src/main/scala/scalafix/internal/rule/RemoveUnused.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class RemoveUnused(config: RemoveUnusedConfig)
3030
override def isRewrite: Boolean = true
3131

3232
private def warnUnusedPrefix = List("-Wunused", "-Ywarn-unused")
33-
private def warnUnusedString = List("-Xlint", "-Xlint:unused")
33+
private def warnUnusedString = List("-Wall", "-Xlint", "-Xlint:unused")
3434
override def withConfiguration(config: Configuration): Configured[Rule] = {
3535
val diagnosticsAvailableInSemanticdb =
3636
Seq("3.0", "3.1", "3.2", "3.3.0", "3.3.1", "3.3.2", "3.3.3")
@@ -43,8 +43,8 @@ class RemoveUnused(config: RemoveUnusedConfig)
4343
if (!hasWarnUnused) {
4444
Configured.error(
4545
"""|A Scala compiler option is required to use RemoveUnused. To fix this problem,
46-
|update your build to add -Ywarn-unused (with 2.12), -Wunused (with 2.13), or
47-
|-Wunused:all (with 3.3.4+)""".stripMargin
46+
|update your build to add -Ywarn-unused (with 2.12), -Wunused (with 2.13),
47+
|-Wunused:all (with 3.3.4+), or -Wall (with 3.5.2+ and backported to 3.3.5+)""".stripMargin
4848
)
4949
} else if (!diagnosticsAvailableInSemanticdb) {
5050
Configured.error(

0 commit comments

Comments
 (0)