Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mention how to prevent unused import warnings #562

Merged
merged 1 commit into from
Oct 18, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,14 @@ scalacOptions += "-P:semanticdb:synthetics:on"
> scalafixAll dependency:Collection213CrossCompat@org.scala-lang.modules:scala-collection-migrations:<version>
```

### Fixing unused import warnings
In Scala 2.13 the `import scala.collection.compat._` sometimes is not needed (e.g. `.to(SeqType)` is natively available).
This leads to a `unused import` warning under Scala 2.13 even though the import is required for Scala 2.12.
In order to work around this, you can pass a compiler option to ignore this specific issue, e.g. in SBT:
```scala
scalacOptions += "-Wconf:origin=scala.collection.compat.*:s"
```

### Contributing

The migration tool is not exhaustive. Contributions of additional rewrites are welcome. If you encounter a use case that’s not supported, please report it as described in the [contributing
Expand Down