From 1991005bd1e237c7c6737ee318a90516a74100e8 Mon Sep 17 00:00:00 2001 From: Mark Canlas Date: Wed, 7 Aug 2024 07:11:06 -0400 Subject: [PATCH] scalafmt braces --- .scalafmt.conf | 4 ++++ build.sbt | 2 +- .../main/scala/com/htmlism/spawningpool/SolutionContext.scala | 3 +-- .../src/main/scala/com/htmlism/spawningpool/Solver.scala | 2 +- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/.scalafmt.conf b/.scalafmt.conf index 881eb35..f6f04bf 100644 --- a/.scalafmt.conf +++ b/.scalafmt.conf @@ -50,5 +50,9 @@ docstrings.wrap = yes includeNoParensInSelectChains = true optIn.breakChainOnFirstMethodDot = true +rewrite.rules = [RedundantBraces] +rewrite.redundantBraces.ifElseExpressions = true +rewrite.redundantBraces.stringInterpolation = true + rewrite.scala3.convertToNewSyntax = true rewrite.scala3.removeOptionalBraces = true diff --git a/build.sbt b/build.sbt index 5137d2e..6e4088f 100644 --- a/build.sbt +++ b/build.sbt @@ -2,7 +2,7 @@ val commonSettings = Seq( organization := "com.htmlism", scalaVersion := "2.13.14", crossScalaVersions := Seq("2.12.19", "2.13.14"), - scalacOptions += "-Xsource:3" + scalacOptions += "-Xsource:3" ) lazy val core = Project("spawning-pool-core", file("spawning-pool-core")) diff --git a/spawning-pool-core/src/main/scala/com/htmlism/spawningpool/SolutionContext.scala b/spawning-pool-core/src/main/scala/com/htmlism/spawningpool/SolutionContext.scala index 9e5d1d5..96fd098 100644 --- a/spawning-pool-core/src/main/scala/com/htmlism/spawningpool/SolutionContext.scala +++ b/spawning-pool-core/src/main/scala/com/htmlism/spawningpool/SolutionContext.scala @@ -28,9 +28,8 @@ object SolutionContext { */ def apply[A, B](islandId: Int, fitness: A => B, evolver: Evolver[A], mutationRate: Double, population: Seq[A])( implicit ordering: Ordering[B] - ): SolutionContext[A, B] = { + ): SolutionContext[A, B] = new SolutionContext(islandId, fitness, evolver, mutationRate, population, 0) - } } /** diff --git a/spawning-pool-core/src/main/scala/com/htmlism/spawningpool/Solver.scala b/spawning-pool-core/src/main/scala/com/htmlism/spawningpool/Solver.scala index 956a2d5..c8172e6 100644 --- a/spawning-pool-core/src/main/scala/com/htmlism/spawningpool/Solver.scala +++ b/spawning-pool-core/src/main/scala/com/htmlism/spawningpool/Solver.scala @@ -89,7 +89,7 @@ class Solver[A, B]( def solve(implicit src: ChromosomeGenerator[A], ec: ExecutionContext): Future[Solutions] = Future { - evolveFrom { Vector.fill(populationSize)(src.generateChromosome) } + evolveFrom(Vector.fill(populationSize)(src.generateChromosome)) } def solve(seed: List[A])(implicit ec: ExecutionContext): Future[Solutions] =