Skip to content

Commit

Permalink
adjust some formatting a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
mr-git committed May 8, 2024
1 parent 18e825e commit de57d6e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,4 @@ addCommandAlias("build", "all compile test")

// https://github.com/scalacenter/scalafix/issues/1488
addCommandAlias("check", "scalafixAll --check; all scalafmtCheckAll scalafmtSbtCheck")
addCommandAlias("fix", "scalafixAll; all scalafmtAll scalafmtSbt")
addCommandAlias("fmt", "scalafixAll; all scalafmtAll scalafmtSbt")
18 changes: 10 additions & 8 deletions src/main/scala/com/evolution/resourcepool/ResourcePool.scala
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,12 @@ object ResourcePool {
object State {

def empty: State =
Allocated(id = 0L, entries = Map.empty, stage = Allocated.Stage.free(List.empty), releasing = Set.empty)
Allocated(
id = 0L,
entries = Map.empty,
stage = Allocated.Stage.free(List.empty),
releasing = Set.empty,
)

/** Resource pool is allocated.
*
Expand Down Expand Up @@ -306,8 +311,7 @@ object ResourcePool {
}

case (state: State.Released, _) =>
state.released.get.rethrow
.map(_.asRight[Int])
state.released.get.rethrow.map(_.asRight[Int])
}
}
}
Expand Down Expand Up @@ -562,16 +566,14 @@ object ResourcePool {
case stage: State.Allocated.Stage.Busy =>
state.copy(
stage = stage.copy(
tasks = stage.tasks
.filter(_ ne task),
tasks = stage.tasks.filter(_ ne task),
),
)
}

case state: State.Released =>
state.copy(tasks =
state.tasks
.filter(_ ne task),
state.copy(
tasks = state.tasks.filter(_ ne task),
)
}

Expand Down

0 comments on commit de57d6e

Please sign in to comment.