Skip to content
This repository has been archived by the owner on Jul 14, 2023. It is now read-only.

Commit

Permalink
Make it clear that only RemovedUnused.imports is not safe to use toge…
Browse files Browse the repository at this point in the history
…ther with OrganizeImports
  • Loading branch information
liancheng committed Jul 18, 2020
1 parent 3cb4837 commit 5adfdeb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ ThisBuild / scalafixDependencies += "com.github.liancheng" %% "organize-imports"
[[remove-unused-warning]]
[WARNING]
====
Please do NOT use the Scalafix built-in `RemoveUnsed` rule together with `OrganizeImports` to remove unused imports. You may end up with broken code!
Please do NOT use the Scalafix built-in `RemoveUnsed.imports` together with `OrganizeImports` to remove unused imports. You may end up with broken code! It is still safe to use `RemoveUnsed` to remove unused private members or local definitions, though.
Scalafix rewrites source files by applying patches generated by invoked rules. Each rule generates a patch based on the _original_ text of the source files. Therefore, when two patches generated by different rules conflict with each other, Scalafix is not able to reconcile the conflicts, and may produce broken code. This is exactly what happens when `RemoveUnused` and `OrganizeImports` are used together, since both rules rewrite import statements.
Expand Down

0 comments on commit 5adfdeb

Please sign in to comment.