Merge pull request #27045 from chbatey/scalafmt-RC7

Upgrade scalafmt to 2.0.0-RC7
This commit is contained in:
Patrik Nordwall 2019-05-29 15:21:11 +02:00 committed by GitHub
commit 11453aad5d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 39 additions and 44 deletions

View file

@ -1,4 +1,4 @@
version = 2.0.0-RC5 version = 2.0.0-RC7
style = defaultWithAlign style = defaultWithAlign

View file

@ -131,8 +131,9 @@ class LocalActorRefProviderSpec extends AkkaSpec(LocalActorRefProviderSpec.confi
for (i <- 0 until 100) { for (i <- 0 until 100) {
val address = "new-actor" + i val address = "new-actor" + i
implicit val timeout = Timeout(5 seconds) implicit val timeout = Timeout(5 seconds)
val actors = for (_ <- 1 to 4) val actors =
yield Future(system.actorOf(Props(new Actor { def receive = { case _ => } }), address)) for (_ <- 1 to 4)
yield Future(system.actorOf(Props(new Actor { def receive = { case _ => } }), address))
val set = Set() ++ actors.map(a => val set = Set() ++ actors.map(a =>
Await.ready(a, timeout.duration).value match { Await.ready(a, timeout.duration).value match {
case Some(Success(_: ActorRef)) => 1 case Some(Success(_: ActorRef)) => 1

View file

@ -298,11 +298,10 @@ trait SchedulerSpec extends BeforeAndAfterEach with DefaultTimeout with Implicit
} }
val latencies = within(10.seconds) { val latencies = within(10.seconds) {
for (i <- 1 to N) for (i <- 1 to N)
yield yield try expectMsgType[Long]
try expectMsgType[Long] catch {
catch { case NonFatal(e) => throw new Exception(s"failed expecting the $i-th latency", e)
case NonFatal(e) => throw new Exception(s"failed expecting the $i-th latency", e) }
}
} }
val histogram = latencies.groupBy(_ / 100000000L) val histogram = latencies.groupBy(_ / 100000000L)
for (k <- histogram.keys.toSeq.sorted) { for (k <- histogram.keys.toSeq.sorted) {
@ -371,11 +370,10 @@ class LightArrayRevolverSchedulerSpec extends AkkaSpec(SchedulerSpec.testConfRev
println(cancelled) println(cancelled)
val latencies = within(10.seconds) { val latencies = within(10.seconds) {
for (i <- 1 to (N - cancelled)) for (i <- 1 to (N - cancelled))
yield yield try expectMsgType[Long]
try expectMsgType[Long] catch {
catch { case NonFatal(e) => throw new Exception(s"failed expecting the $i-th latency", e)
case NonFatal(e) => throw new Exception(s"failed expecting the $i-th latency", e) }
}
} }
val histogram = latencies.groupBy(_ / 100000000L) val histogram = latencies.groupBy(_ / 100000000L)
for (k <- histogram.keys.toSeq.sorted) { for (k <- histogram.keys.toSeq.sorted) {

View file

@ -37,18 +37,17 @@ class CircuitBreakerMTSpec extends AkkaSpec {
def testCallsWithBreaker(): immutable.IndexedSeq[Future[String]] = { def testCallsWithBreaker(): immutable.IndexedSeq[Future[String]] = {
val aFewActive = new TestLatch(5) val aFewActive = new TestLatch(5)
for (_ <- 1 to numberOfTestCalls) for (_ <- 1 to numberOfTestCalls)
yield yield breaker
breaker .withCircuitBreaker(Future {
.withCircuitBreaker(Future { aFewActive.countDown()
Await.ready(aFewActive, 5.seconds.dilated)
"succeed"
})
.recoverWith {
case _: CircuitBreakerOpenException =>
aFewActive.countDown() aFewActive.countDown()
Await.ready(aFewActive, 5.seconds.dilated) Future.successful("CBO")
"succeed" }
})
.recoverWith {
case _: CircuitBreakerOpenException =>
aFewActive.countDown()
Future.successful("CBO")
}
} }
"allow many calls while in closed state with no errors" in { "allow many calls while in closed state with no errors" in {

View file

@ -131,13 +131,12 @@ object StandardMetrics {
for { for {
used <- nodeMetrics.metric(HeapMemoryUsed) used <- nodeMetrics.metric(HeapMemoryUsed)
committed <- nodeMetrics.metric(HeapMemoryCommitted) committed <- nodeMetrics.metric(HeapMemoryCommitted)
} yield } yield (
( nodeMetrics.address,
nodeMetrics.address, nodeMetrics.timestamp,
nodeMetrics.timestamp, used.smoothValue.longValue,
used.smoothValue.longValue, committed.smoothValue.longValue,
committed.smoothValue.longValue, nodeMetrics.metric(HeapMemoryMax).map(_.smoothValue.longValue))
nodeMetrics.metric(HeapMemoryMax).map(_.smoothValue.longValue))
} }
} }
@ -183,14 +182,13 @@ object StandardMetrics {
nodeMetrics: NodeMetrics): Option[(Address, Long, Option[Double], Option[Double], Option[Double], Int)] = { nodeMetrics: NodeMetrics): Option[(Address, Long, Option[Double], Option[Double], Option[Double], Int)] = {
for { for {
processors <- nodeMetrics.metric(Processors) processors <- nodeMetrics.metric(Processors)
} yield } yield (
( nodeMetrics.address,
nodeMetrics.address, nodeMetrics.timestamp,
nodeMetrics.timestamp, nodeMetrics.metric(SystemLoadAverage).map(_.smoothValue),
nodeMetrics.metric(SystemLoadAverage).map(_.smoothValue), nodeMetrics.metric(CpuCombined).map(_.smoothValue),
nodeMetrics.metric(CpuCombined).map(_.smoothValue), nodeMetrics.metric(CpuStolen).map(_.smoothValue),
nodeMetrics.metric(CpuStolen).map(_.smoothValue), processors.value.intValue)
processors.value.intValue)
} }
} }

View file

@ -117,11 +117,10 @@ trait PersistenceMatchers {
nrs = seq.map(_.replaceFirst(prefixes(pos), "").toInt) nrs = seq.map(_.replaceFirst(prefixes(pos), "").toInt)
sortedNrs = nrs.sorted sortedNrs = nrs.sorted
if nrs != sortedNrs if nrs != sortedNrs
} yield } yield MatchResult(
MatchResult( false,
false, s"""Messages sequence with prefix ${prefixes(pos)} was not sorted! Was: $seq"""",
s"""Messages sequence with prefix ${prefixes(pos)} was not sorted! Was: $seq"""", s"""Messages sequence with prefix ${prefixes(pos)} was sorted! Was: $seq"""")
s"""Messages sequence with prefix ${prefixes(pos)} was sorted! Was: $seq"""")
if (results.forall(_.matches)) MatchResult(true, "", "") if (results.forall(_.matches)) MatchResult(true, "", "")
else results.find(r => !r.matches).get else results.find(r => !r.matches).get