Skip to content

Commit 04f8a69

Browse files
Update scalafmt-core to 3.8.2 (#154)
Co-authored-by: scala-steward <scala-steward>
1 parent cf4b0eb commit 04f8a69

File tree

12 files changed

+44
-40
lines changed

12 files changed

+44
-40
lines changed

.git-blame-ignore-revs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,6 @@ e988553eda72e5b4ea0760ff5e95bf0af12e9921
33

44
# Scala Steward: Reformat with scalafmt 3.8.1
55
5c6ea70f91018a2c0d16116c82cab92ee4d507f0
6+
7+
# Scala Steward: Reformat with scalafmt 3.8.2
8+
b73b3c3f8fcaaa70595cd267f7242b0a0c345039

.scalafmt.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
version = 3.8.1
1+
version = 3.8.2
22
maxColumn = 140
33
runner.dialect = scala3

core/src/main/scala/ox/channels/SourceCompanionIOOps.scala

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,7 @@ trait SourceCompanionIOOps:
3434
chunks.done()
3535
false
3636
else
37-
if readBytes > 0 then
38-
chunks.send(if readBytes == chunkSize then Chunk.fromArray(buf) else Chunk.fromArray(buf.take(readBytes)))
37+
if readBytes > 0 then chunks.send(if readBytes == chunkSize then Chunk.fromArray(buf) else Chunk.fromArray(buf.take(readBytes)))
3938
true
4039
}
4140
catch

core/src/main/scala/ox/channels/SourceCompanionOps.scala

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -386,4 +386,3 @@ trait SourceCompanionOps:
386386
val c = Channel.rendezvous[T]
387387
c.errorOrClosed(t)
388388
c
389-

core/src/main/scala/ox/channels/SourceIOOps.scala

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -39,23 +39,24 @@ trait SourceIOOps[+T]:
3939
* @throws IOException
4040
* if an error occurs when writing or closing of the `OutputStream`.
4141
*/
42-
def toOutputStream(outputStream: OutputStream)(using T <:< Chunk[Byte], IO): Unit =
43-
repeatWhile {
44-
outer.receiveOrClosed() match
45-
case ChannelClosed.Done =>
46-
close(outputStream)
47-
false
48-
case ChannelClosed.Error(e) =>
49-
close(outputStream, Some(e))
50-
throw e
51-
case chunk: T @unchecked =>
52-
try
53-
outputStream.write(chunk.toArray)
54-
true
55-
catch case NonFatal(e) =>
42+
def toOutputStream(outputStream: OutputStream)(using T <:< Chunk[Byte], IO): Unit =
43+
repeatWhile {
44+
outer.receiveOrClosed() match
45+
case ChannelClosed.Done =>
46+
close(outputStream)
47+
false
48+
case ChannelClosed.Error(e) =>
49+
close(outputStream, Some(e))
50+
throw e
51+
case chunk: T @unchecked =>
52+
try
53+
outputStream.write(chunk.toArray)
54+
true
55+
catch
56+
case NonFatal(e) =>
5657
close(outputStream, Some(e))
57-
throw e
58-
}
58+
throw e
59+
}
5960

6061
/** Writes content of this `Source` to a file.
6162
*
@@ -86,14 +87,14 @@ trait SourceIOOps[+T]:
8687
try
8788
jFileChannel.write(ByteBuffer.wrap(chunk.toArray))
8889
true
89-
catch case NonFatal(e) =>
90-
close(jFileChannel, Some(e))
91-
throw e
90+
catch
91+
case NonFatal(e) =>
92+
close(jFileChannel, Some(e))
93+
throw e
9294
}
9395

9496
private inline def close(closeable: Closeable, cause: Option[Throwable] = None)(using IO): Unit =
95-
try
96-
closeable.close()
97+
try closeable.close()
9798
catch
9899
case NonFatal(closeException) =>
99100
cause.foreach(_.addSuppressed(closeException))

core/src/main/scala/ox/channels/SourceTextOps.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ trait SourceTextOps[+T]:
158158
outer.receiveOrClosed() match
159159
// end of channel before getting enough bytes to resolve BOM, assuming no BOM
160160
case ChannelClosed.Done =>
161-
if (buffer != null) then
161+
if (buffer != null) then
162162
// There's a buffer accumulated (not BOM), decode it directly
163163
outputChannel.send(buffer.asStringUtf8)
164164
outputChannel.done()

core/src/main/scala/ox/channels/actor.scala

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,7 @@ class ActorRef[T](c: Sink[T => Unit]):
4545
def ask[U](f: T => U): U =
4646
val cf = new CompletableFuture[U]()
4747
c.send { t =>
48-
try
49-
cf.complete(f(t)).discard
48+
try cf.complete(f(t)).discard
5049
catch
5150
case NonFatal(e) =>
5251
// since this is an ask, only propagating the exception to the caller, not to the scope

core/src/main/scala/ox/resilience/Schedule.scala

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ object Schedule:
4848
*/
4949
def forever(delay: FiniteDuration): Infinite = DelayForever(delay)
5050

51-
case class DelayForever private[resilience](delay: FiniteDuration) extends Infinite:
51+
case class DelayForever private[resilience] (delay: FiniteDuration) extends Infinite:
5252
override def nextDelay(attempt: Int, lastDelay: Option[FiniteDuration]): FiniteDuration = delay
5353

5454
/** A schedule that retries up to a given number of times, with an increasing delay (backoff) between subsequent attempts.
@@ -115,8 +115,11 @@ object Schedule:
115115
def forever(initialDelay: FiniteDuration, maxDelay: FiniteDuration = 1.minute, jitter: Jitter = Jitter.None): Infinite =
116116
BackoffForever(initialDelay, maxDelay, jitter)
117117

118-
case class BackoffForever private[resilience](initialDelay: FiniteDuration, maxDelay: FiniteDuration = 1.minute, jitter: Jitter = Jitter.None)
119-
extends Infinite:
118+
case class BackoffForever private[resilience] (
119+
initialDelay: FiniteDuration,
120+
maxDelay: FiniteDuration = 1.minute,
121+
jitter: Jitter = Jitter.None
122+
) extends Infinite:
120123
override def nextDelay(attempt: Int, lastDelay: Option[FiniteDuration]): FiniteDuration =
121124
Backoff.nextDelay(attempt, initialDelay, maxDelay, jitter, lastDelay)
122125

core/src/main/scala/ox/supervised.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,17 @@ import scala.reflect.ClassTag
1212
* [[fork]] (daemon) don't have to complete successfully for the scope to end.
1313
* - the scope also ends once the first supervised fork (including the `f` main body) fails with an exception
1414
* - when the scope **ends**, all running forks are cancelled
15-
* - the scope **completes** (that is, this method returns) only once all forks started by `f` have completed (either successfully, or with
16-
* an exception)
15+
* - the scope **completes** (that is, this method returns) only once all forks started by `f` have completed (either successfully, or
16+
* with an exception)
1717
*
1818
* Upon successful completion, returns the result of evaluating `f`. Upon failure, the exception that caused the scope to end is re-thrown
1919
* (regardless if the exception was thrown from the main body, or from a fork). Any other exceptions that occur when completing the scope
2020
* are added as suppressed.
2121
*
2222
* @see
23-
* [[unsupervised]] Starts a scope in unsupervised mode
23+
* [[unsupervised]] Starts a scope in unsupervised mode
2424
* @see
25-
* [[supervisedError]] Starts a scope in supervised mode, with the additional ability to report application errors
25+
* [[supervisedError]] Starts a scope in supervised mode, with the additional ability to report application errors
2626
*/
2727
def supervised[T](f: Ox ?=> T): T = supervisedError(NoErrorMode)(f)
2828

core/src/main/scala/ox/unsupervised.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import java.util.concurrent.StructuredTaskScope
44

55
private class DoNothingScope[T] extends StructuredTaskScope[T](null, Thread.ofVirtual().factory()) {}
66

7-
/** Starts a new concurrency scope, which allows starting forks in the given code block `f`. Forks can be started using [[forkUnsupervised]], and
8-
* [[forkCancellable]]. All forks are guaranteed to complete before this scope completes.
7+
/** Starts a new concurrency scope, which allows starting forks in the given code block `f`. Forks can be started using
8+
* [[forkUnsupervised]], and [[forkCancellable]]. All forks are guaranteed to complete before this scope completes.
99
*
1010
* It is advisable to use [[supervised]] scopes if possible, as they minimise the chances of an error to go unnoticed.
1111
*

0 commit comments

Comments
 (0)