Skip to content

Commit e9965a3

Browse files
Remove unsafe returned value from swap
1 parent c552441 commit e9965a3

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

docs/std/nonemptyhotswap.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ to `Hotswap` which remove the `Option` wrapper.
1616

1717
```scala
1818
sealed trait NonEmptyHotswap[F[_], R] {
19-
def swap(next: Resource[F, R]): F[R]
19+
def swap(next: Resource[F, R]): F[Unit]
2020
def get: Resource[F, R]
2121
}
2222
```

std/shared/src/main/scala/cats/effect/std/NonEmptyHotswap.scala

+2-2
Original file line numberDiff line numberDiff line change
@@ -117,12 +117,12 @@ object NonEmptyHotswap {
117117
Resource.make(initialize)(finalize).map { state =>
118118
new NonEmptyHotswap[F, R] {
119119

120-
override def swap(next: Resource[F, R]): F[R] =
120+
override def swap(next: Resource[F, R]): F[Unit] =
121121
F.uncancelable { poll =>
122122
poll(next.allocated).flatMap {
123123
case (r, fin) =>
124124
exclusive.mapK(poll).onCancel(Resource.eval(fin)).surround {
125-
swapFinalizer(Acquired(r, fin)).as(r)
125+
swapFinalizer(Acquired(r, fin))
126126
}
127127
}
128128
}

0 commit comments

Comments
 (0)