diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs index 3f7e5a0e..b8292282 100644 --- a/.git-blame-ignore-revs +++ b/.git-blame-ignore-revs @@ -6,3 +6,6 @@ # Scala Steward: Reformat with scalafmt 3.10.1 e20c58d38034869ac908a00d87dbb975f2cac2cc + +# Scala Steward: Reformat with scalafmt 3.10.2 +097d85055d194076e79b37dac018093ab252efe0 diff --git a/.scalafmt.conf b/.scalafmt.conf index b3e2c97d..f3479b28 100644 --- a/.scalafmt.conf +++ b/.scalafmt.conf @@ -1,4 +1,4 @@ -version = 3.10.1 +version = 3.10.2 maxColumn = 120 diff --git a/actor-tests/src/test/scala/com/evolutiongaming/akkaeffect/CounterSpec.scala b/actor-tests/src/test/scala/com/evolutiongaming/akkaeffect/CounterSpec.scala index 70c837a7..65e5ec13 100644 --- a/actor-tests/src/test/scala/com/evolutiongaming/akkaeffect/CounterSpec.scala +++ b/actor-tests/src/test/scala/com/evolutiongaming/akkaeffect/CounterSpec.scala @@ -95,9 +95,10 @@ class CounterSpec extends AsyncFunSuite with ActorSuite with Matchers { val expect = (n: Int) => for { a <- probe.expect[Int] - } yield for { - a <- a - } yield a.msg shouldEqual n + } yield + for { + a <- a + } yield a.msg shouldEqual n for { a <- expect(1) _ <- inc diff --git a/actor/src/main/scala/com/evolutiongaming/akkaeffect/Ask.scala b/actor/src/main/scala/com/evolutiongaming/akkaeffect/Ask.scala index 25fd35c9..29bcd6db 100644 --- a/actor/src/main/scala/com/evolutiongaming/akkaeffect/Ask.scala +++ b/actor/src/main/scala/com/evolutiongaming/akkaeffect/Ask.scala @@ -99,19 +99,21 @@ object Ask { for { a <- af(msg) b <- self(a, timeout, sender) - } yield for { - b <- b - b <- bf(b) - } yield b + } yield + for { + b <- b + b <- bf(b) + } yield b } def narrow[A1 <: A, B1](f: B => F[B1])(implicit F: FlatMap[F]): Ask[F, A1, B1] = { (msg, timeout, sender) => for { b <- self(msg, timeout, sender) - } yield for { - b <- b - b <- f(b) - } yield b + } yield + for { + b <- b + b <- f(b) + } yield b } } diff --git a/actor/src/test/scala/com/evolutiongaming/akkaeffect/ActorVarTest.scala b/actor/src/test/scala/com/evolutiongaming/akkaeffect/ActorVarTest.scala index 0ba1078a..a8eb6088 100644 --- a/actor/src/test/scala/com/evolutiongaming/akkaeffect/ActorVarTest.scala +++ b/actor/src/test/scala/com/evolutiongaming/akkaeffect/ActorVarTest.scala @@ -80,12 +80,13 @@ class ActorVarTest extends AsyncFunSuite with Matchers { actorVar.receive { state0 => for { _ <- actions.add(Action.Updated(state0, state)) - } yield for { - state <- state - } yield { - val release = actions.add(Action.Released(state)) - Releasable(state, release.some) - } + } yield + for { + state <- state + } yield { + val release = actions.add(Action.Released(state)) + Releasable(state, release.some) + } } } _ <- GenSpawn[F].cede diff --git a/cluster-sharding/src/test/scala/com/evolutiongaming/akkaeffect/cluster/sharding/ClusterShardingLocalTest.scala b/cluster-sharding/src/test/scala/com/evolutiongaming/akkaeffect/cluster/sharding/ClusterShardingLocalTest.scala index 994baa33..d486dd0f 100644 --- a/cluster-sharding/src/test/scala/com/evolutiongaming/akkaeffect/cluster/sharding/ClusterShardingLocalTest.scala +++ b/cluster-sharding/src/test/scala/com/evolutiongaming/akkaeffect/cluster/sharding/ClusterShardingLocalTest.scala @@ -83,25 +83,26 @@ class ClusterShardingLocalTest extends AsyncFunSuite with ActorSuite with Matche ) actorEffect = ActorEffect.fromActor[IO](actorRef) - } yield for { - a <- probe.expect[Int] - b <- actorEffect.ask(ShardedMsg("id", 0), 1.second) - a <- a - _ <- IO(a.msg shouldEqual 0) - _ <- IO(a.from.tell(a.msg.toString, ActorRef.noSender)) - b <- b - _ <- IO(b shouldEqual "0") - a <- probe.expect[HandOffStopMsg.type] - _ <- clusterShardingLocal.rebalance - a <- a - _ <- IO(a.msg shouldEqual HandOffStopMsg) - r <- clusterShardingLocal.clusterSharding.regions - _ <- IO(r shouldEqual Set(typeName)) - s <- clusterShardingLocal.clusterSharding.shards(r.head) - _ <- IO(s shouldEqual Set(ShardState("1", Set.empty))) - r <- clusterShardingLocal.clusterSharding.shardRegion(typeName) - _ <- IO(r shouldEqual actorRef) - } yield {} + } yield + for { + a <- probe.expect[Int] + b <- actorEffect.ask(ShardedMsg("id", 0), 1.second) + a <- a + _ <- IO(a.msg shouldEqual 0) + _ <- IO(a.from.tell(a.msg.toString, ActorRef.noSender)) + b <- b + _ <- IO(b shouldEqual "0") + a <- probe.expect[HandOffStopMsg.type] + _ <- clusterShardingLocal.rebalance + a <- a + _ <- IO(a.msg shouldEqual HandOffStopMsg) + r <- clusterShardingLocal.clusterSharding.regions + _ <- IO(r shouldEqual Set(typeName)) + s <- clusterShardingLocal.clusterSharding.shards(r.head) + _ <- IO(s shouldEqual Set(ShardState("1", Set.empty))) + r <- clusterShardingLocal.clusterSharding.shardRegion(typeName) + _ <- IO(r shouldEqual actorRef) + } yield {} result .use(identity) diff --git a/cluster-sharding/src/test/scala/com/evolutiongaming/akkaeffect/cluster/sharding/ClusterShardingTest.scala b/cluster-sharding/src/test/scala/com/evolutiongaming/akkaeffect/cluster/sharding/ClusterShardingTest.scala index dd1703de..0932bc1d 100644 --- a/cluster-sharding/src/test/scala/com/evolutiongaming/akkaeffect/cluster/sharding/ClusterShardingTest.scala +++ b/cluster-sharding/src/test/scala/com/evolutiongaming/akkaeffect/cluster/sharding/ClusterShardingTest.scala @@ -55,11 +55,12 @@ class ClusterShardingTest extends AsyncFunSuite with ActorSuite with Matchers { new LeastShardAllocationStrategy(1, 1), HandOffStopMessage, ) - } yield for { - a <- probe.expect[Unit] - _ <- IO(shardRegion.tell((), probe.actorEffect.toUnsafe)) - a <- a - } yield a.msg + } yield + for { + a <- probe.expect[Unit] + _ <- IO(shardRegion.tell((), probe.actorEffect.toUnsafe)) + a <- a + } yield a.msg result .use(identity) .run() diff --git a/eventsourcing/src/main/scala/com/evolutiongaming/akkaeffect/eventsourcing/Engine.scala b/eventsourcing/src/main/scala/com/evolutiongaming/akkaeffect/eventsourcing/Engine.scala index 447f7d1f..abb8793c 100644 --- a/eventsourcing/src/main/scala/com/evolutiongaming/akkaeffect/eventsourcing/Engine.scala +++ b/eventsourcing/src/main/scala/com/evolutiongaming/akkaeffect/eventsourcing/Engine.scala @@ -252,10 +252,11 @@ object Engine { d <- Deferred[F, Either[Throwable, A]] f <- loadOf(load, d).start _ <- offer(f) - } yield for { - a <- d.get - a <- a.liftTo[F] - } yield a + } yield + for { + a <- d.get + a <- a.liftTo[F] + } yield a } } engine <- fenced(engine) @@ -312,10 +313,11 @@ object Engine { fv <- load.start // fork `load` stage to allow multiple independent executions fu = execute(fv.joinWithNever, d) _ <- queue(Key.validate.some)(fu) - } yield for { - e <- d.get - a <- e.liftTo[F] - } yield a + } yield + for { + e <- d.get + a <- e.liftTo[F] + } yield a /** Execute `load` with respect to: * 1. failure on `load` or `validate` will be propagated to user 2. stopped Engine will not persist any events diff --git a/eventsourcing/src/main/scala/com/evolutiongaming/akkaeffect/eventsourcing/Journaller.scala b/eventsourcing/src/main/scala/com/evolutiongaming/akkaeffect/eventsourcing/Journaller.scala index b3db8fba..157fcd64 100644 --- a/eventsourcing/src/main/scala/com/evolutiongaming/akkaeffect/eventsourcing/Journaller.scala +++ b/eventsourcing/src/main/scala/com/evolutiongaming/akkaeffect/eventsourcing/Journaller.scala @@ -39,10 +39,11 @@ object Journaller { for { d <- MeasureDuration[F].start r <- self.deleteTo(seqNr) - } yield for { - r <- r - d <- d - _ <- log.info(s"delete events to $seqNr in ${d.toMillis}ms") - } yield r + } yield + for { + r <- r + d <- d + _ <- log.info(s"delete events to $seqNr in ${d.toMillis}ms") + } yield r } } diff --git a/persistence/src/main/scala/com/evolutiongaming/akkaeffect/persistence/Append.scala b/persistence/src/main/scala/com/evolutiongaming/akkaeffect/persistence/Append.scala index 1f599c38..ad0ad030 100644 --- a/persistence/src/main/scala/com/evolutiongaming/akkaeffect/persistence/Append.scala +++ b/persistence/src/main/scala/com/evolutiongaming/akkaeffect/persistence/Append.scala @@ -137,11 +137,12 @@ object Append { for { d <- MeasureDuration[F].start r <- self(events) - } yield for { - r <- r - d <- d - _ <- log.debug(s"append ${events.size} events in ${d.toMillis}ms") - } yield r + } yield + for { + r <- r + d <- d + _ <- log.debug(s"append ${events.size} events in ${d.toMillis}ms") + } yield r def withFail(fail: Fail[F])(implicit F: MonadThrowable[F]): Append[F, A] = { events => fail.adapt(s"failed to append $events")(self(events)) diff --git a/persistence/src/main/scala/com/evolutiongaming/akkaeffect/persistence/DeleteEventsTo.scala b/persistence/src/main/scala/com/evolutiongaming/akkaeffect/persistence/DeleteEventsTo.scala index 0bcc0c00..0eb97942 100644 --- a/persistence/src/main/scala/com/evolutiongaming/akkaeffect/persistence/DeleteEventsTo.scala +++ b/persistence/src/main/scala/com/evolutiongaming/akkaeffect/persistence/DeleteEventsTo.scala @@ -59,11 +59,12 @@ object DeleteEventsTo { for { d <- MeasureDuration[F].start r <- self(seqNr) - } yield for { - r <- r - d <- d - _ <- log.info(s"delete events to $seqNr in ${d.toMillis}ms") - } yield r + } yield + for { + r <- r + d <- d + _ <- log.info(s"delete events to $seqNr in ${d.toMillis}ms") + } yield r } def withFail(fail: Fail[F])(implicit diff --git a/persistence/src/main/scala/com/evolutiongaming/akkaeffect/persistence/Snapshotter.scala b/persistence/src/main/scala/com/evolutiongaming/akkaeffect/persistence/Snapshotter.scala index e7804fa2..8445a32b 100644 --- a/persistence/src/main/scala/com/evolutiongaming/akkaeffect/persistence/Snapshotter.scala +++ b/persistence/src/main/scala/com/evolutiongaming/akkaeffect/persistence/Snapshotter.scala @@ -99,31 +99,34 @@ object Snapshotter { for { d <- MeasureDuration[F].start r <- self.save(seqNr, snapshot) - } yield for { - r <- r - d <- d - _ <- log.info(s"save snapshot at $seqNr in ${d.toMillis}ms") - } yield r + } yield + for { + r <- r + d <- d + _ <- log.info(s"save snapshot at $seqNr in ${d.toMillis}ms") + } yield r def delete(seqNr: SeqNr) = for { d <- MeasureDuration[F].start r <- self.delete(seqNr) - } yield for { - r <- r - d <- d - _ <- log.info(s"delete snapshot at $seqNr in ${d.toMillis}ms") - } yield r + } yield + for { + r <- r + d <- d + _ <- log.info(s"delete snapshot at $seqNr in ${d.toMillis}ms") + } yield r def delete(criteria: SnapshotSelectionCriteria) = for { d <- MeasureDuration[F].start r <- self.delete(criteria) - } yield for { - r <- r - d <- d - _ <- log.info(s"delete snapshots for $criteria in ${d.toMillis}ms") - } yield r + } yield + for { + r <- r + d <- d + _ <- log.info(s"delete snapshots for $criteria in ${d.toMillis}ms") + } yield r } def withFail(fail: Fail[F])(implicit diff --git a/persistence/src/test/scala/com/evolutiongaming/akkaeffect/persistence/InstrumentEventSourced.scala b/persistence/src/test/scala/com/evolutiongaming/akkaeffect/persistence/InstrumentEventSourced.scala index d1e47fc0..76fe9be7 100644 --- a/persistence/src/test/scala/com/evolutiongaming/akkaeffect/persistence/InstrumentEventSourced.scala +++ b/persistence/src/test/scala/com/evolutiongaming/akkaeffect/persistence/InstrumentEventSourced.scala @@ -63,20 +63,22 @@ object InstrumentEventSourced { _ <- record(Action.AppendEvents(events)) seqNr <- journaller.append(events) _ <- record(Action.AppendEventsOuter) - } yield for { - seqNr <- seqNr - _ <- record(Action.AppendEventsInner(seqNr)) - } yield seqNr + } yield + for { + seqNr <- seqNr + _ <- record(Action.AppendEventsInner(seqNr)) + } yield seqNr def deleteTo = (seqNr: SeqNr) => for { _ <- record(Action.DeleteEventsTo(seqNr)) a <- journaller.deleteTo(seqNr) _ <- record(Action.DeleteEventsToOuter) - } yield for { - a <- a - _ <- record(Action.DeleteEventsToInner) - } yield a + } yield + for { + a <- a + _ <- record(Action.DeleteEventsToInner) + } yield a } val snapshotter1 = new Instrument with Snapshotter[F, S] { @@ -86,30 +88,33 @@ object InstrumentEventSourced { _ <- record(Action.SaveSnapshot(seqNr, snapshot)) a <- snapshotter.save(seqNr, snapshot) _ <- record(Action.SaveSnapshotOuter) - } yield for { - a <- a - _ <- record(Action.SaveSnapshotInner) - } yield a + } yield + for { + a <- a + _ <- record(Action.SaveSnapshotInner) + } yield a def delete(seqNr: SeqNr) = for { _ <- record(Action.DeleteSnapshot(seqNr)) a <- snapshotter.delete(seqNr) _ <- record(Action.DeleteSnapshotOuter) - } yield for { - a <- a - _ <- record(Action.DeleteSnapshotInner) - } yield a + } yield + for { + a <- a + _ <- record(Action.DeleteSnapshotInner) + } yield a def delete(criteria: SnapshotSelectionCriteria) = for { _ <- record(Action.DeleteSnapshots(criteria)) a <- snapshotter.delete(criteria) _ <- record(Action.DeleteSnapshotsOuter) - } yield for { - a <- a - _ <- record(Action.DeleteSnapshotsInner) - } yield a + } yield + for { + a <- a + _ <- record(Action.DeleteSnapshotsInner) + } yield a } for {