Skip to content

Commit

Permalink
Update scalafmt-core to 2.7.0
Browse files Browse the repository at this point in the history
  • Loading branch information
47erbot committed Sep 9, 2020
1 parent 125f6e7 commit 0f64cf8
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 35 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.6.4
version = 2.7.0
style = defaultWithAlign
maxColumn = 100

Expand Down
8 changes: 4 additions & 4 deletions pbdirect/src/main/scala/pbdirect/PBMessageReader.scala
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,12 @@ trait PBMessageReaderImplicits {

object collectFieldIndices extends Poly1 {
implicit def annotatedCase[N <: Nat] =
at[(Some[pbIndex], N)] {
case (Some(annotation), _) => FieldIndex(annotation.first :: annotation.more.toList)
at[(Some[pbIndex], N)] { case (Some(annotation), _) =>
FieldIndex(annotation.first :: annotation.more.toList)
}
implicit def unannotatedCase[N <: Nat](implicit toInt: ToInt[N]) =
at[(None.type, N)] {
case (None, _) => FieldIndex(List(toInt() + 1))
at[(None.type, N)] { case (None, _) =>
FieldIndex(List(toInt() + 1))
}
}

Expand Down
20 changes: 8 additions & 12 deletions pbdirect/src/main/scala/pbdirect/PBMessageWriter.scala
Original file line number Diff line number Diff line change
Expand Up @@ -59,27 +59,23 @@ trait PBMessageWriterImplicits {

object zipWithFieldIndex extends Poly2 {
implicit def annotatedCase[T, N <: Nat] =
at[Some[pbIndex], (T, N)] {
case (Some(annotation), (value, _)) =>
(FieldIndex(annotation.first :: annotation.more.toList), value)
at[Some[pbIndex], (T, N)] { case (Some(annotation), (value, _)) =>
(FieldIndex(annotation.first :: annotation.more.toList), value)
}
implicit def unannotatedCase[T, N <: Nat](implicit toInt: ToInt[N]) =
at[None.type, (T, N)] {
case (None, (value, _)) =>
(FieldIndex(List(toInt() + 1)), value)
at[None.type, (T, N)] { case (None, (value, _)) =>
(FieldIndex(List(toInt() + 1)), value)
}
}

object zipWithModifiers extends Poly2 {
implicit def annotatedCase[A] =
at[(FieldIndex, A), Some[pbUnpacked]] {
case ((fieldIndex, value), Some(_)) =>
(fieldIndex, value, FieldModifiers(unpacked = true))
at[(FieldIndex, A), Some[pbUnpacked]] { case ((fieldIndex, value), Some(_)) =>
(fieldIndex, value, FieldModifiers(unpacked = true))
}
implicit def unannotatedCase[A] =
at[(FieldIndex, A), None.type] {
case ((fieldIndex, value), None) =>
(fieldIndex, value, FieldModifiers(unpacked = false))
at[(FieldIndex, A), None.type] { case ((fieldIndex, value), None) =>
(fieldIndex, value, FieldModifiers(unpacked = false))
}
}

Expand Down
15 changes: 6 additions & 9 deletions pbdirect/src/test/scala/pbdirect/ProtocComparisonSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -236,9 +236,8 @@ object ProtocComparisonSpec {

def stringStringMap(map: Map[String, String]): String = {
map
.map {
case (key, value) =>
s"""|stringStringMap: {
.map { case (key, value) =>
s"""|stringStringMap: {
| key: ${string(key)}
| value: ${string(value)}
|}""".stripMargin
Expand All @@ -248,9 +247,8 @@ object ProtocComparisonSpec {

def intMessageTwoMap(map: Map[Int, MessageTwo]): String = {
map
.map {
case (key, value) =>
s"""|intMessageTwoMap: {
.map { case (key, value) =>
s"""|intMessageTwoMap: {
| key: ${key}
| value: {
|${indent(indent(messageTwo(value)))}
Expand All @@ -262,9 +260,8 @@ object ProtocComparisonSpec {

def signedIntFixedLongMap(map: Map[Int @@ Signed, Long @@ Fixed]): String = {
map
.map {
case (key, value) =>
s"""|signedIntFixedLongMap: {
.map { case (key, value) =>
s"""|signedIntFixedLongMap: {
| key: ${key}
| value: ${value.toString}
|}""".stripMargin
Expand Down
17 changes: 8 additions & 9 deletions pbdirect/src/test/scala/pbdirect/RoundTripSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -233,15 +233,14 @@ trait PBEquivalenceImplicits_1 extends PBEquivalenceImplicits_2 {
fieldEquivs: ZipWith.Aux[R, R, fieldEquivalence.type, FEs],
fold: LeftFolder.Aux[FEs, Boolean, conj.type, Boolean]
): PBEquivalence[A] =
instance("message") {
case (a1, a2) =>
val hlist1 = gen.to(a1)
val hlist2 = gen.to(a2)
val booleans = hlist1.zipWith(hlist2)(fieldEquivalence) // fieldEquivs.apply(hlist1, hlist2)
val result = booleans.foldLeft(true)(conj)
if (!result)
println(booleans)
result
instance("message") { case (a1, a2) =>
val hlist1 = gen.to(a1)
val hlist2 = gen.to(a2)
val booleans = hlist1.zipWith(hlist2)(fieldEquivalence) // fieldEquivs.apply(hlist1, hlist2)
val result = booleans.foldLeft(true)(conj)
if (!result)
println(booleans)
result
}

}
Expand Down

0 comments on commit 0f64cf8

Please sign in to comment.