Skip to content

Commit

Permalink
refactor: prefer given/using instead of implicit
Browse files Browse the repository at this point in the history
  • Loading branch information
etorreborre committed Aug 8, 2024
1 parent 5219d33 commit d34eaff
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit d34eaff

Please sign in to comment.