Skip to content

Commit

Permalink
Fix warning for scalafix/rules
Browse files Browse the repository at this point in the history
  • Loading branch information
lenguyenthanh committed Aug 17, 2024
1 parent 3f4e34f commit 26a6a3c
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions scalafix/rules/src/main/scala/fix/v0_5.scala
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,9 @@ class v0_5 extends SemanticRule("v0_5") {

def handleImports(importees: List[Importee], createNewImport: Importee => Patch): Patch =
importees.collect {
case importee @ Importee.Name(name) =>
case importee @ Importee.Name(_) =>
createNewImport(importee) + Patch.removeImportee(importee)
case rename @ Importee.Rename(name, _) =>
case rename @ Importee.Rename(_, _) =>
createNewImport(rename) + Patch.removeImportee(rename)
case importee @ Importee.Wildcard() =>
createNewImport(importee) + Patch.removeImportee(importee)
Expand All @@ -108,7 +108,7 @@ class v0_5 extends SemanticRule("v0_5") {
override def fix(implicit doc: SemanticDocument): Patch =
doc.tree.collect {
// Handle imports from `io.github.davidgregory084`
case importer @ Importer(ref, importees) if PackageSym.matches(ref) =>
case _ @Importer(ref, importees) if PackageSym.matches(ref) =>
importees.collect {
case importee @ Importee.Name(name) if PluginSym.matches(name) =>
makePluginImport(importee) + Patch.removeImportee(importee)
Expand All @@ -124,25 +124,25 @@ class v0_5 extends SemanticRule("v0_5") {
Patch.removeImportee(importee)
}.asPatch
// Handle imports from `io.github.davidgregory084.TpolecatPlugin`
case importer @ Importer(ref, importees) if TpolecatPluginSym.matches(ref) =>
case _ @Importer(ref, importees) if TpolecatPluginSym.matches(ref) =>
handleImports(importees, makeTpolecatPluginObjectImport)
// Handle imports from `io.github.davidgregory084.ScalaVersion`
case importer @ Importer(ref, importees) if ScalaVersionSym.matches(ref) =>
case _ @Importer(ref, importees) if ScalaVersionSym.matches(ref) =>
handleImports(importees, makeScalaVersionObjectImport)
// Handle imports from `io.github.davidgregory084.TpolecatPlugin.ScalacOptions`
case importer @ Importer(ref, importees) if TpolecatPluginScalacOptionsSym.matches(ref) =>
case _ @Importer(ref, importees) if TpolecatPluginScalacOptionsSym.matches(ref) =>
handleImports(importees, makeScalacOptionsObjectImport)
// Handle imports from `io.github.davidgregory084.TpolecatPlugin.autoImport`
case importer @ Importer(ref, importees) if TpolecatPluginAutoImportSym.matches(ref) =>
case _ @Importer(ref, importees) if TpolecatPluginAutoImportSym.matches(ref) =>
importees.collect {
// The `ScalacOptions` object moved to `scalac-options`
case importee @ Importee.Name(name) if TpolecatPluginScalacOptionsSym.matches(name) =>
makeScalacOptionsImport(importee) + Patch.removeImportee(importee)
case rename @ Importee.Rename(name, _) if TpolecatPluginScalacOptionsSym.matches(name) =>
makeScalacOptionsImport(rename) + Patch.removeImportee(rename)
case importee @ Importee.Name(name) =>
case importee @ Importee.Name(_) =>
makeAutoImportObjectImport(importee) + Patch.removeImportee(importee)
case rename @ Importee.Rename(name, _) =>
case rename @ Importee.Rename(_, _) =>
makeAutoImportObjectImport(rename) + Patch.removeImportee(rename)
case importee @ Importee.Wildcard() =>
makeAutoImportObjectImport(importee) + Patch.removeImportee(importee)
Expand Down

0 comments on commit 26a6a3c

Please sign in to comment.