Skip to content

Commit

Permalink
Update scalafmt-core to 2.5.1 (scalacenter#35)
Browse files Browse the repository at this point in the history
  • Loading branch information
liancheng authored May 5, 2020
1 parent e7d7d9c commit 13a04d2
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version = "2.4.2"
version = "2.5.1"

align {
arrowEnumeratorGenerator = false
Expand Down
9 changes: 5 additions & 4 deletions rules/src/main/scala/fix/OrganizeImports.scala
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,11 @@ class OrganizeImports(config: OrganizeImportsConfig) extends SemanticRule("Organ
.map(_.position)
.toSet

def importeePosition(importee: Importee): Position = importee match {
case Importee.Rename(from, _) => from.pos
case _ => importee.pos
}
def importeePosition(importee: Importee): Position =
importee match {
case Importee.Rename(from, _) => from.pos
case _ => importee.pos
}

val unusedRemoved = importer.importees filterNot { importee =>
unusedImports contains importeePosition(importee)
Expand Down
21 changes: 12 additions & 9 deletions rules/src/main/scala/fix/OrganizeImportsConfig.scala
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@ object ImportsOrder {
case object Ascii extends ImportsOrder
case object SymbolsFirst extends ImportsOrder

implicit def reader: ConfDecoder[ImportsOrder] = ReaderUtil.fromMap {
List(Ascii, SymbolsFirst) groupBy (_.toString) mapValues (_.head)
}
implicit def reader: ConfDecoder[ImportsOrder] =
ReaderUtil.fromMap {
List(Ascii, SymbolsFirst) groupBy (_.toString) mapValues (_.head)
}
}

sealed trait ImportSelectorsOrder
Expand All @@ -24,9 +25,10 @@ object ImportSelectorsOrder {
case object SymbolsFirst extends ImportSelectorsOrder
case object Keep extends ImportSelectorsOrder

implicit def reader: ConfDecoder[ImportSelectorsOrder] = ReaderUtil.fromMap {
List(Ascii, SymbolsFirst, Keep) groupBy (_.toString) mapValues (_.head)
}
implicit def reader: ConfDecoder[ImportSelectorsOrder] =
ReaderUtil.fromMap {
List(Ascii, SymbolsFirst, Keep) groupBy (_.toString) mapValues (_.head)
}
}

sealed trait GroupedImports
Expand All @@ -36,9 +38,10 @@ object GroupedImports {
case object Explode extends GroupedImports
case object Keep extends GroupedImports

implicit def reader: ConfDecoder[GroupedImports] = ReaderUtil.fromMap {
List(Merge, Explode, Keep) groupBy (_.toString) mapValues (_.head)
}
implicit def reader: ConfDecoder[GroupedImports] =
ReaderUtil.fromMap {
List(Merge, Explode, Keep) groupBy (_.toString) mapValues (_.head)
}
}

final case class OrganizeImportsConfig(
Expand Down

0 comments on commit 13a04d2

Please sign in to comment.