From 2cda6cd39c614e85fb29a792198816cbc4f83f5c Mon Sep 17 00:00:00 2001 From: Erik LaBianca Date: Mon, 1 Oct 2018 13:45:07 -0400 Subject: [PATCH] Add align=none, maxColumn=120 and modifications' --- .scalafmt.conf | 2 ++ js/src/main/scala/cats/js/instances/future.scala | 11 ++++------- js/src/test/scala/cats/tests/FutureTests.scala | 11 +++-------- jvm/src/test/scala/cats/tests/FutureSuite.scala | 11 +++-------- 4 files changed, 12 insertions(+), 23 deletions(-) diff --git a/.scalafmt.conf b/.scalafmt.conf index 2d337307f36..96d15f8b0aa 100644 --- a/.scalafmt.conf +++ b/.scalafmt.conf @@ -1 +1,3 @@ // default settings +align=none +maxColumn = 120 diff --git a/js/src/main/scala/cats/js/instances/future.scala b/js/src/main/scala/cats/js/instances/future.scala index 6429e8b8963..055ab9869b0 100644 --- a/js/src/main/scala/cats/js/instances/future.scala +++ b/js/src/main/scala/cats/js/instances/future.scala @@ -14,7 +14,7 @@ object future extends FutureInstances0 object Await { def result[A](f: Future[A], atMost: FiniteDuration): A = f.value match { case Some(v) => v.get - case None => throw new IllegalStateException() + case None => throw new IllegalStateException() } } @@ -25,8 +25,7 @@ private[instances] sealed trait FutureInstances0 extends FutureInstances1 { Await.result(x, atMost) } - def futureOrder[A: Order](atMost: FiniteDuration)( - implicit ec: E): Order[Future[A]] = + def futureOrder[A: Order](atMost: FiniteDuration)(implicit ec: E): Order[Future[A]] = new Order[Future[A]] { def compare(x: Future[A], y: Future[A]): Int = Await.result((x zip y).map { case (x, y) => x compare y }, atMost) @@ -34,12 +33,10 @@ private[instances] sealed trait FutureInstances0 extends FutureInstances1 { } private[instances] sealed trait FutureInstances1 extends FutureInstances2 { - def futurePartialOrder[A: PartialOrder](atMost: FiniteDuration)( - implicit ec: E): PartialOrder[Future[A]] = + def futurePartialOrder[A: PartialOrder](atMost: FiniteDuration)(implicit ec: E): PartialOrder[Future[A]] = new PartialOrder[Future[A]] { def partialCompare(x: Future[A], y: Future[A]): Double = - Await.result((x zip y).map { case (x, y) => x partialCompare y }, - atMost) + Await.result((x zip y).map { case (x, y) => x partialCompare y }, atMost) } } diff --git a/js/src/test/scala/cats/tests/FutureTests.scala b/js/src/test/scala/cats/tests/FutureTests.scala index ab2c7fd5b4d..6a4f9057a7a 100644 --- a/js/src/test/scala/cats/tests/FutureTests.scala +++ b/js/src/test/scala/cats/tests/FutureTests.scala @@ -2,10 +2,7 @@ package cats package js package tests -import cats.kernel.laws.discipline.{ - MonoidTests => MonoidLawTests, - SemigroupTests => SemigroupLawTests -} +import cats.kernel.laws.discipline.{MonoidTests => MonoidLawTests, SemigroupTests => SemigroupLawTests} import cats.laws.discipline._ import cats.js.instances.Await import cats.js.instances.future.futureComonad @@ -56,15 +53,13 @@ class FutureTests extends CatsSuite { implicit def cogenForFuture[A]: Cogen[Future[A]] = Cogen[Unit].contramap(_ => ()) - checkAll("Future[Int]", - MonadErrorTests[Future, Throwable].monadError[Int, Int, Int]) + checkAll("Future[Int]", MonadErrorTests[Future, Throwable].monadError[Int, Int, Int]) checkAll("Future[Int]", ComonadTests[Future].comonad[Int, Int, Int]) checkAll("Future", MonadTests[Future].monad[Int, Int, Int]) { implicit val F = ListWrapper.semigroup[Int] - checkAll("Future[ListWrapper[Int]]", - SemigroupLawTests[Future[ListWrapper[Int]]].semigroup) + checkAll("Future[ListWrapper[Int]]", SemigroupLawTests[Future[ListWrapper[Int]]].semigroup) } checkAll("Future[Int]", MonoidLawTests[Future[Int]].monoid) diff --git a/jvm/src/test/scala/cats/tests/FutureSuite.scala b/jvm/src/test/scala/cats/tests/FutureSuite.scala index 8df9ae6d826..e541beb5fd7 100644 --- a/jvm/src/test/scala/cats/tests/FutureSuite.scala +++ b/jvm/src/test/scala/cats/tests/FutureSuite.scala @@ -2,10 +2,7 @@ package cats package jvm package tests -import cats.kernel.laws.discipline.{ - MonoidTests => MonoidLawTests, - SemigroupTests => SemigroupLawTests -} +import cats.kernel.laws.discipline.{MonoidTests => MonoidLawTests, SemigroupTests => SemigroupLawTests} import cats.laws.discipline._ import cats.laws.discipline.arbitrary._ import cats.tests.{CatsSuite, ListWrapper} @@ -43,15 +40,13 @@ class FutureSuite extends CatsSuite { implicit val nonFatalArbitrary: Arbitrary[Throwable] = Arbitrary(arbitrary[Exception].map(identity)) - checkAll("Future with Throwable", - MonadErrorTests[Future, Throwable].monadError[Int, Int, Int]) + checkAll("Future with Throwable", MonadErrorTests[Future, Throwable].monadError[Int, Int, Int]) checkAll("Future", MonadTests[Future].monad[Int, Int, Int]) checkAll("Future", CoflatMapTests[Future].coflatMap[Int, Int, Int]) { implicit val F = ListWrapper.semigroup[Int] - checkAll("Future[ListWrapper[Int]]", - SemigroupLawTests[Future[ListWrapper[Int]]].semigroup) + checkAll("Future[ListWrapper[Int]]", SemigroupLawTests[Future[ListWrapper[Int]]].semigroup) } checkAll("Future[Int]", MonoidLawTests[Future[Int]].monoid)