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

Update to Scalafmt 2.6.0 #3476

Merged
merged 6 commits into from
Jun 18, 2020
Merged
Show file tree
Hide file tree
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
4 changes: 3 additions & 1 deletion .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version=2.5.3
version=2.6.0
align.openParenCallSite = true
align.openParenDefnSite = true
maxColumn = 120
Expand All @@ -8,3 +8,5 @@ danglingParentheses = true
rewrite.rules = [AvoidInfix, SortImports, RedundantParens, SortModifiers]
docstrings = JavaDoc
newlines.afterCurlyLambda = preserve
docstrings.style = Asterisk
docstrings.oneline = unfold
8 changes: 4 additions & 4 deletions alleycats-core/src/main/scala/alleycats/ConsK.scala
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ object ConsK {
def cons[A](hd: A, tl: F[A]): F[A] = s.combineK(p.pure(hd), tl)
}

/****************************************************************************/
/* ======================================================================== */
/* THE FOLLOWING CODE IS MANAGED BY SIMULACRUM; PLEASE DO NOT EDIT!!!! */
/****************************************************************************/
/* ======================================================================== */

/**
* Summon an instance of [[ConsK]] for `F`.
Expand Down Expand Up @@ -54,8 +54,8 @@ object ConsK {
}
}

/****************************************************************************/
/* ======================================================================== */
/* END OF SIMULACRUM-MANAGED CODE */
/****************************************************************************/
/* ======================================================================== */

}
8 changes: 4 additions & 4 deletions alleycats-core/src/main/scala/alleycats/Empty.scala
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ object Empty extends EmptyInstances0 {

def fromEmptyK[F[_], T](implicit ekf: EmptyK[F]): Empty[F[T]] = ekf.synthesize[T]

/****************************************************************************/
/* ======================================================================== */
/* THE FOLLOWING CODE IS MANAGED BY SIMULACRUM; PLEASE DO NOT EDIT!!!! */
/****************************************************************************/
/* ======================================================================== */

/**
* Summon an instance of [[Empty]] for `A`.
Expand Down Expand Up @@ -64,9 +64,9 @@ object Empty extends EmptyInstances0 {
}
}

/****************************************************************************/
/* ======================================================================== */
/* END OF SIMULACRUM-MANAGED CODE */
/****************************************************************************/
/* ======================================================================== */

}

Expand Down
8 changes: 4 additions & 4 deletions alleycats-core/src/main/scala/alleycats/EmptyK.scala
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ import scala.annotation.implicitNotFound

object EmptyK {

/****************************************************************************/
/* ======================================================================== */
/* THE FOLLOWING CODE IS MANAGED BY SIMULACRUM; PLEASE DO NOT EDIT!!!! */
/****************************************************************************/
/* ======================================================================== */

/**
* Summon an instance of [[EmptyK]] for `F`.
Expand Down Expand Up @@ -54,8 +54,8 @@ object EmptyK {
}
}

/****************************************************************************/
/* ======================================================================== */
/* END OF SIMULACRUM-MANAGED CODE */
/****************************************************************************/
/* ======================================================================== */

}
8 changes: 4 additions & 4 deletions alleycats-core/src/main/scala/alleycats/Extract.scala
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ object Extract {
def coflatMap[A, B](fa: F[A])(f: F[A] => B): F[B] = cf.coflatMap(fa)(f)
}

/****************************************************************************/
/* ======================================================================== */
/* THE FOLLOWING CODE IS MANAGED BY SIMULACRUM; PLEASE DO NOT EDIT!!!! */
/****************************************************************************/
/* ======================================================================== */

/**
* Summon an instance of [[Extract]] for `F`.
Expand Down Expand Up @@ -65,8 +65,8 @@ object Extract {
}
}

/****************************************************************************/
/* ======================================================================== */
/* END OF SIMULACRUM-MANAGED CODE */
/****************************************************************************/
/* ======================================================================== */

}
8 changes: 4 additions & 4 deletions alleycats-core/src/main/scala/alleycats/One.scala
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ object One {
def apply[A](a: => A): One[A] =
new One[A] { lazy val one: A = a }

/****************************************************************************/
/* ======================================================================== */
/* THE FOLLOWING CODE IS MANAGED BY SIMULACRUM; PLEASE DO NOT EDIT!!!! */
/****************************************************************************/
/* ======================================================================== */

/**
* Summon an instance of [[One]] for `A`.
Expand Down Expand Up @@ -61,8 +61,8 @@ object One {
}
}

/****************************************************************************/
/* ======================================================================== */
/* END OF SIMULACRUM-MANAGED CODE */
/****************************************************************************/
/* ======================================================================== */

}
8 changes: 4 additions & 4 deletions alleycats-core/src/main/scala/alleycats/Pure.scala
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ object Pure {
def tailRecM[A, B](a: A)(f: (A) => F[Either[A, B]]): F[B] = fm.tailRecM(a)(f)
}

/****************************************************************************/
/* ======================================================================== */
/* THE FOLLOWING CODE IS MANAGED BY SIMULACRUM; PLEASE DO NOT EDIT!!!! */
/****************************************************************************/
/* ======================================================================== */

/**
* Summon an instance of [[Pure]] for `F`.
Expand Down Expand Up @@ -64,8 +64,8 @@ object Pure {
}
}

/****************************************************************************/
/* ======================================================================== */
/* END OF SIMULACRUM-MANAGED CODE */
/****************************************************************************/
/* ======================================================================== */

}
8 changes: 4 additions & 4 deletions alleycats-core/src/main/scala/alleycats/Zero.scala
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ object Zero {
def apply[A](a: => A): Zero[A] =
new Zero[A] { lazy val zero: A = a }

/****************************************************************************/
/* ======================================================================== */
/* THE FOLLOWING CODE IS MANAGED BY SIMULACRUM; PLEASE DO NOT EDIT!!!! */
/****************************************************************************/
/* ======================================================================== */

/**
* Summon an instance of [[Zero]] for `A`.
Expand Down Expand Up @@ -62,8 +62,8 @@ object Zero {
}
}

/****************************************************************************/
/* ======================================================================== */
/* END OF SIMULACRUM-MANAGED CODE */
/****************************************************************************/
/* ======================================================================== */

}
4 changes: 2 additions & 2 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ lazy val scoverageSettings = Seq(
)

organization in ThisBuild := "org.typelevel"
scalafixDependencies in ThisBuild += "org.typelevel" %% "simulacrum-scalafix" % "0.3.0"
scalafixDependencies in ThisBuild += "org.typelevel" %% "simulacrum-scalafix" % "0.4.0"

val isTravisBuild = settingKey[Boolean]("Flag indicating whether the current build is running under Travis")
val crossScalaVersionsFromTravis = settingKey[Seq[String]]("Scala versions set in .travis.yml as scala_version_XXX")
Expand Down Expand Up @@ -80,7 +80,7 @@ lazy val catsSettings = Seq(
lazy val simulacrumSettings = Seq(
addCompilerPlugin(scalafixSemanticdb),
scalacOptions ++= Seq(s"-P:semanticdb:targetroot:${baseDirectory.value}/target/.semanticdb", "-Yrangepos"),
libraryDependencies += "org.typelevel" %% "simulacrum-scalafix-annotations" % "0.3.0",
libraryDependencies += "org.typelevel" %% "simulacrum-scalafix-annotations" % "0.4.0",
pomPostProcess := { (node: xml.Node) =>
new RuleTransformer(new RewriteRule {
override def transform(node: xml.Node): Seq[xml.Node] =
Expand Down
5 changes: 2 additions & 3 deletions core/src/main/scala-2.12/cats/compat/FoldableCompat.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ private[cats] object FoldableCompat {

def toIterable[F[_], A](fa: F[A])(F: Foldable[F]): Iterable[A] =
F.foldRight[A, Stream[A]](fa, Eval.now(Stream.empty)) { (a, eb) =>
eb.map(Stream.cons(a, _))
}
.value
eb.map(Stream.cons(a, _))
}.value
}
5 changes: 2 additions & 3 deletions core/src/main/scala-2.13+/cats/compat/FoldableCompat.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ private[cats] object FoldableCompat {

def toIterable[F[_], A](fa: F[A])(F: Foldable[F]): Iterable[A] =
F.foldRight[A, LazyList[A]](fa, Eval.now(LazyList.empty)) { (a, eb) =>
eb.map(LazyList.cons(a, _))
}
.value
eb.map(LazyList.cons(a, _))
}.value
}
13 changes: 6 additions & 7 deletions core/src/main/scala-2.13+/cats/data/NonEmptyLazyList.scala
Original file line number Diff line number Diff line change
Expand Up @@ -418,44 +418,43 @@ class NonEmptyLazyListOps[A](private val value: NonEmptyLazyList[A])

/**
* Creates new `NonEmptyMap`, similarly to List#toMap from scala standard library.
*{{{
* {{{
* scala> import cats.data.{NonEmptyLazyList, NonEmptyMap}
* scala> import cats.implicits._
* scala> val nel = NonEmptyLazyList.fromLazyListPrepend((0, "a"), LazyList((1, "b"),(0, "c"), (2, "d")))
* scala> val expectedResult = NonEmptyMap.of(0 -> "c", 1 -> "b", 2 -> "d")
* scala> val result = nel.toNem
* scala> result === expectedResult
* res0: Boolean = true
*}}}
*
* }}}
*/
final def toNem[T, U](implicit ev: A <:< (T, U), order: Order[T]): NonEmptyMap[T, U] =
NonEmptyMap.fromMapUnsafe(SortedMap(toLazyList.map(ev): _*)(order.toOrdering))

/**
* Creates new `NonEmptySet`, similarly to List#toSet from scala standard library.
*{{{
* {{{
* scala> import cats.data._
* scala> import cats.instances.int._
* scala> val nel = NonEmptyLazyList.fromLazyListPrepend(1, LazyList(2,2,3,4))
* scala> nel.toNes
* res0: cats.data.NonEmptySet[Int] = TreeSet(1, 2, 3, 4)
*}}}
* }}}
*/
final def toNes[B >: A](implicit order: Order[B]): NonEmptySet[B] =
NonEmptySet.of(head, tail: _*)

/**
* Creates new `NonEmptyVector`, similarly to List#toVector from scala standard library.
*{{{
* {{{
* scala> import cats.data._
* scala> import cats.instances.int._
* scala> val nel = NonEmptyLazyList.fromLazyListPrepend(1, LazyList(2,3,4))
* scala> val expectedResult = NonEmptyVector.fromVectorUnsafe(Vector(1,2,3,4))
* scala> val result = nel.toNev
* scala> result === expectedResult
* res0: Boolean = true
*}}}
* }}}
*/
final def toNev[B >: A]: NonEmptyVector[B] =
NonEmptyVector.fromVectorUnsafe(toLazyList.toVector)
Expand Down
14 changes: 6 additions & 8 deletions core/src/main/scala-2.13+/cats/instances/arraySeq.scala
Original file line number Diff line number Diff line change
Expand Up @@ -192,16 +192,14 @@ private[cats] object ArraySeqInstances {
fa: ArraySeq[A]
)(f: (A) => G[Option[B]])(implicit G: Applicative[G]): G[ArraySeq[B]] =
fa.foldRight(Eval.now(G.pure(ArraySeq.untagged.empty[B]))) {
case (x, xse) =>
G.map2Eval(f(x), xse)((i, o) => i.fold(o)(_ +: o))
}
.value
case (x, xse) =>
G.map2Eval(f(x), xse)((i, o) => i.fold(o)(_ +: o))
}.value

override def filterA[G[_], A](fa: ArraySeq[A])(f: (A) => G[Boolean])(implicit G: Applicative[G]): G[ArraySeq[A]] =
fa.foldRight(Eval.now(G.pure(ArraySeq.untagged.empty[A]))) {
case (x, xse) =>
G.map2Eval(f(x), xse)((b, vec) => if (b) x +: vec else vec)
}
.value
case (x, xse) =>
G.map2Eval(f(x), xse)((b, vec) => if (b) x +: vec else vec)
}.value
}
}
8 changes: 4 additions & 4 deletions core/src/main/scala/cats/Align.scala
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,9 @@ object Align extends ScalaVersionSpecificAlignInstances {
)
}

/****************************************************************************/
/* ======================================================================== */
/* THE FOLLOWING CODE IS MANAGED BY SIMULACRUM; PLEASE DO NOT EDIT!!!! */
/****************************************************************************/
/* ======================================================================== */

/**
* Summon an instance of [[Align]] for `F`.
Expand Down Expand Up @@ -176,8 +176,8 @@ object Align extends ScalaVersionSpecificAlignInstances {
}
}

/****************************************************************************/
/* ======================================================================== */
/* END OF SIMULACRUM-MANAGED CODE */
/****************************************************************************/
/* ======================================================================== */

}
8 changes: 4 additions & 4 deletions core/src/main/scala/cats/Alternative.scala
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,9 @@ import scala.annotation.implicitNotFound

object Alternative {

/****************************************************************************/
/* ======================================================================== */
/* THE FOLLOWING CODE IS MANAGED BY SIMULACRUM; PLEASE DO NOT EDIT!!!! */
/****************************************************************************/
/* ======================================================================== */

/**
* Summon an instance of [[Alternative]] for `F`.
Expand Down Expand Up @@ -139,8 +139,8 @@ object Alternative {
}
}

/****************************************************************************/
/* ======================================================================== */
/* END OF SIMULACRUM-MANAGED CODE */
/****************************************************************************/
/* ======================================================================== */

}
8 changes: 4 additions & 4 deletions core/src/main/scala/cats/Applicative.scala
Original file line number Diff line number Diff line change
Expand Up @@ -230,9 +230,9 @@ object Applicative {
def map[A, B](fa: F[A])(f: A => B): F[B] = F.map(fa)(f)
}

/****************************************************************************/
/* ======================================================================== */
/* THE FOLLOWING CODE IS MANAGED BY SIMULACRUM; PLEASE DO NOT EDIT!!!! */
/****************************************************************************/
/* ======================================================================== */

/**
* Summon an instance of [[Applicative]] for `F`.
Expand Down Expand Up @@ -271,9 +271,9 @@ object Applicative {
}
}

/****************************************************************************/
/* ======================================================================== */
/* END OF SIMULACRUM-MANAGED CODE */
/****************************************************************************/
/* ======================================================================== */

}

Expand Down
2 changes: 1 addition & 1 deletion core/src/main/scala/cats/ApplicativeError.scala
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ trait ApplicativeError[F[_], E] extends Applicative[F] {
* scala> val prog2: F[Int] = (Err("two")).raiseError[F, Int]
*
* scala> prog1.onError(action).value.run("").value

*
* res0: (String, Either[Err,Int]) = (one,Left(Err(one)))
*
* scala> prog2.onError(action).value.run("").value
Expand Down
Loading