Skip to content

Commit

Permalink
Update scalafmt-core to 3.8.3 (#395)
Browse files Browse the repository at this point in the history
* Update scalafmt-core to 3.8.3

* Reformat with scalafmt 3.8.3

Executed command: scalafmt --non-interactive

* Add 'Reformat with scalafmt 3.8.3' to .git-blame-ignore-revs
  • Loading branch information
scala-steward authored Jul 29, 2024
1 parent 9a782dd commit 0941e7c
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 25 deletions.
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

0 comments on commit 0941e7c

Please sign in to comment.