From d34eaff59d1086de4841e505e23025ef5569d5dc Mon Sep 17 00:00:00 2001 From: etorreborre Date: Thu, 8 Aug 2024 18:11:10 +0200 Subject: [PATCH] refactor: prefer given/using instead of implicit --- .../src/main/scala/org/specs2/specification/Contexts.scala | 4 ++-- .../main/scala/org/specs2/specification/core/Execution.scala | 2 +- .../main/scala/org/specs2/scalacheck/ScalaCheckProperty.scala | 2 +- .../org/specs2/scalacheck/ScalaCheckPropertyCreation.scala | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/core/shared/src/main/scala/org/specs2/specification/Contexts.scala b/core/shared/src/main/scala/org/specs2/specification/Contexts.scala index 318d760d27..b9030bc1be 100644 --- a/core/shared/src/main/scala/org/specs2/specification/Contexts.scala +++ b/core/shared/src/main/scala/org/specs2/specification/Contexts.scala @@ -68,7 +68,7 @@ trait Resource[T] extends BeforeAfterSpec with FragmentsFactory: def beforeSpec = fragmentFactory.step(Execution.withEnvAsync { env => - implicit val ec = env.executionContext + given ec: ExecutionContext = env.executionContext lazy val acquireResource: Future[T] = acquire.recoverWith { case e: Exception => Future.failed[T](new Exception("resource unavailable", e)) @@ -101,7 +101,7 @@ trait Resource[T] extends BeforeAfterSpec with FragmentsFactory: fragmentFactory.break, fragmentFactory.step { Execution.withEnvFlatten { env => - implicit val ec = env.executionContext + given ec: ExecutionContext = env.executionContext // synchronize the retrieval of the resource and // its acquisition on the resources map to avoid // concurrency issues diff --git a/core/shared/src/main/scala/org/specs2/specification/core/Execution.scala b/core/shared/src/main/scala/org/specs2/specification/core/Execution.scala index 07e3d46952..698df57baf 100644 --- a/core/shared/src/main/scala/org/specs2/specification/core/Execution.scala +++ b/core/shared/src/main/scala/org/specs2/specification/core/Execution.scala @@ -367,7 +367,7 @@ object Execution: /** create an execution with a future of an Execution */ def futureFlatten[T](f: =>Future[Execution]): Execution = withEnvFlatten(env => - implicit val ec = env.executionContext + given ec: ExecutionContext = env.executionContext Execution(run = Some((env: Env) => f.flatMap { execution => diff --git a/scalacheck/src/main/scala/org/specs2/scalacheck/ScalaCheckProperty.scala b/scalacheck/src/main/scala/org/specs2/scalacheck/ScalaCheckProperty.scala index 75fdf15c5d..611d27e315 100644 --- a/scalacheck/src/main/scala/org/specs2/scalacheck/ScalaCheckProperty.scala +++ b/scalacheck/src/main/scala/org/specs2/scalacheck/ScalaCheckProperty.scala @@ -1326,7 +1326,7 @@ object ScalaCheckProperty: AsResultProp.check(s.prop, s.parameters.overrideWith(env.commandLine), s.prettyFreqMap) } - def makeProp[T](f: T => Prop, shrink: Option[Shrink[T]], parameters: Parameters)(implicit + def makeProp[T](f: T => Prop, shrink: Option[Shrink[T]], parameters: Parameters)(using a: Arbitrary[T], p: T => Pretty ): Prop = diff --git a/scalacheck/src/main/scala/org/specs2/scalacheck/ScalaCheckPropertyCreation.scala b/scalacheck/src/main/scala/org/specs2/scalacheck/ScalaCheckPropertyCreation.scala index 54c7229afe..aa4b4f71f9 100644 --- a/scalacheck/src/main/scala/org/specs2/scalacheck/ScalaCheckPropertyCreation.scala +++ b/scalacheck/src/main/scala/org/specs2/scalacheck/ScalaCheckPropertyCreation.scala @@ -9,7 +9,7 @@ import ScalaCheckProperty.* trait ScalaCheckPropertyCreation: /** create a ScalaCheck property from a function */ - def prop[T, R](result: T => R)(implicit + def prop[T, R](result: T => R)(using arbitrary: Arbitrary[T], shrink: Shrink[T], pretty: T => Pretty,