Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update scalafmt-core to 3.8.3 #395

Merged
merged 3 commits into from
Jul 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,6 @@ e41ea66e8238a2e1e924f3845d923c5911a8f29a

# Scala Steward: Reformat with scalafmt 3.7.17
8bde3f01a9da6f1e81c9c73378c777fa85393280

# Scala Steward: Reformat with scalafmt 3.8.3
43ad6cc42bfdcd3ae2131e47dfb1c70405d103da
2 changes: 1 addition & 1 deletion .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
runner.dialect = scala213
version = "3.8.2"
version = "3.8.3"
maxColumn = 140
trailingCommas = always
align.preset = most
48 changes: 24 additions & 24 deletions colibri/src/main/scala/colibri/Observable.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1318,36 +1318,36 @@ object Observable {

@inline def bufferTimed[Col[a] <: Iterable[a]](duration: FiniteDuration)(implicit factory: Factory[A, Col[A]]): Observable[Col[A]] =
bufferTimedMillis(
duration.toMillis.toInt,
)
duration.toMillis.toInt,
)

def bufferTimedMillis[Col[a] <: Iterable[a]](duration: Int)(implicit factory: Factory[A, Col[A]]): Observable[Col[A]] =
new Observable[Col[A]] {
def unsafeSubscribe(sink: Observer[Col[A]]): Cancelable = {
var isCancel = false
var builder = factory.newBuilder
def unsafeSubscribe(sink: Observer[Col[A]]): Cancelable = {
var isCancel = false
var builder = factory.newBuilder

def send(): Unit = {
sink.unsafeOnNext(builder.result())
builder = factory.newBuilder
}
def send(): Unit = {
sink.unsafeOnNext(builder.result())
builder = factory.newBuilder
}

val intervalId = timers.setInterval(duration.toDouble) { if (!isCancel) send() }
val intervalId = timers.setInterval(duration.toDouble) { if (!isCancel) send() }

Cancelable.composite(
Cancelable { () =>
isCancel = true
timers.clearInterval(intervalId)
},
source.unsafeSubscribe(
Observer.createUnrecovered(
value => builder += value,
sink.unsafeOnError,
Cancelable.composite(
Cancelable { () =>
isCancel = true
timers.clearInterval(intervalId)
},
source.unsafeSubscribe(
Observer.createUnrecovered(
value => builder += value,
sink.unsafeOnError,
),
),
),
)
)
}
}
}

def evalOn(ec: ExecutionContext): Observable[A] = new Observable[A] {
def unsafeSubscribe(sink: Observer[A]): Cancelable = {
Expand Down Expand Up @@ -1474,8 +1474,8 @@ object Observable {

def foldAllF[F[_]: Async, Col[a] <: Iterable[a]](implicit factory: Factory[A, Col[A]]): F[Col[A]] = foldF(factory.newBuilder) {
(buff, next) =>
buff += next
buff
buff += next
buff
}.map(_.result())
def foldAllIO[Col[a] <: Iterable[a]](implicit factory: Factory[A, Col[A]]): IO[Col[A]] = foldAllF[IO, Col]
def foldAll[Col[a] <: Iterable[a]](implicit factory: Factory[A, Col[A]]): Observable[Col[A]] = Observable.fromEffect(foldAllIO[Col])
Expand Down