From 1aff8f280484f4f500793a8ddc93c5271b8fd039 Mon Sep 17 00:00:00 2001 From: Flavio Brasil Date: Wed, 13 Nov 2024 11:49:25 -0800 Subject: [PATCH] cleanup unused code --- kyo-bench/src/main/scala/kyo/bench/BatchBench.scala | 2 -- kyo-bench/src/main/scala/kyo/bench/Bench.scala | 3 --- kyo-caliban/src/main/scala/kyo/Resolvers.scala | 1 - kyo-cats/shared/src/test/scala/kyo/CatsTest.scala | 4 ---- .../shared/src/main/scala/kyo/Constructors.scala | 1 - .../shared/src/test/scala/kyo/ConstructorsTest.scala | 1 - .../shared/src/test/scala/kyo/EnvCombinatorTest.scala | 2 +- kyo-core/shared/src/main/scala/kyo/AllowUnsafe.scala | 2 -- kyo-core/shared/src/main/scala/kyo/Async.scala | 6 ------ kyo-core/shared/src/main/scala/kyo/Clock.scala | 5 ----- kyo-core/shared/src/main/scala/kyo/Fiber.scala | 3 --- kyo-core/shared/src/main/scala/kyo/Meter.scala | 2 -- kyo-core/shared/src/test/scala/kyo/AsyncTest.scala | 6 +++++- kyo-core/shared/src/test/scala/kyo/ClockTest.scala | 2 -- kyo-core/shared/src/test/scala/kyo/FiberTest.scala | 3 --- kyo-core/shared/src/test/scala/kyo/KyoAppTest.scala | 3 --- kyo-core/shared/src/test/scala/kyo/TagCompactTest.scala | 1 - kyo-data/shared/src/main/scala/kyo/Flat.scala | 2 -- kyo-data/shared/src/main/scala/kyo/Frame.scala | 1 - kyo-data/shared/src/main/scala/kyo/Instant.scala | 1 - kyo-data/shared/src/main/scala/kyo/Result.scala | 1 - kyo-data/shared/src/main/scala/kyo/SafeClassTag.scala | 1 - kyo-data/shared/src/main/scala/kyo/Schedule.scala | 1 - kyo-direct/shared/src/test/scala/kyo/DirectTest.scala | 2 -- .../jvm/src/test/scala/kyo/kernel/SafepointTest.scala | 4 ---- kyo-prelude/shared/src/main/scala/kyo/Abort.scala | 1 - .../shared/src/main/scala/kyo/kernel/ArrowEffect.scala | 3 +-- kyo-prelude/shared/src/main/scala/kyo/kernel/Effect.scala | 1 - .../shared/src/main/scala/kyo/kernel/Safepoint.scala | 1 - .../jvm/src/main/scala/kyo/scheduler/Scheduler.scala | 1 - .../src/main/scala/kyo/scheduler/regulator/Regulator.scala | 5 +++-- kyo-zio/shared/src/main/scala/kyo/ZIOs.scala | 3 --- 32 files changed, 10 insertions(+), 65 deletions(-) diff --git a/kyo-bench/src/main/scala/kyo/bench/BatchBench.scala b/kyo-bench/src/main/scala/kyo/bench/BatchBench.scala index 613549d85..e6c7a86ea 100644 --- a/kyo-bench/src/main/scala/kyo/bench/BatchBench.scala +++ b/kyo-bench/src/main/scala/kyo/bench/BatchBench.scala @@ -1,7 +1,5 @@ package kyo.bench -import java.util.concurrent.locks.LockSupport - class BatchBench extends Bench.SyncAndFork(5050): val count = 100 diff --git a/kyo-bench/src/main/scala/kyo/bench/Bench.scala b/kyo-bench/src/main/scala/kyo/bench/Bench.scala index 5251bb06a..3a1b5d321 100644 --- a/kyo-bench/src/main/scala/kyo/bench/Bench.scala +++ b/kyo-bench/src/main/scala/kyo/bench/Bench.scala @@ -1,10 +1,7 @@ package kyo.bench import WarmupJITProfile.* -import java.util.concurrent.CountDownLatch -import java.util.concurrent.Executors import org.openjdk.jmh.annotations.* -import scala.concurrent.duration.* @State(Scope.Benchmark) @Fork( diff --git a/kyo-caliban/src/main/scala/kyo/Resolvers.scala b/kyo-caliban/src/main/scala/kyo/Resolvers.scala index ceeb017e9..d230d25ea 100644 --- a/kyo-caliban/src/main/scala/kyo/Resolvers.scala +++ b/kyo-caliban/src/main/scala/kyo/Resolvers.scala @@ -6,7 +6,6 @@ import caliban.interop.tapir.TapirAdapter.* import kyo.internal.KyoSttpMonad import scala.concurrent.ExecutionContext import sttp.monad.Canceler -import sttp.tapir.Codec.JsonCodec import sttp.tapir.Endpoint import sttp.tapir.capabilities.NoStreams import sttp.tapir.server.ServerEndpoint diff --git a/kyo-cats/shared/src/test/scala/kyo/CatsTest.scala b/kyo-cats/shared/src/test/scala/kyo/CatsTest.scala index 96f926885..2e9f73983 100644 --- a/kyo-cats/shared/src/test/scala/kyo/CatsTest.scala +++ b/kyo-cats/shared/src/test/scala/kyo/CatsTest.scala @@ -1,18 +1,14 @@ package kyo import cats.effect.IO as CatsIO -import cats.effect.kernel.Fiber as CatsFiber -import cats.effect.kernel.Outcome import cats.effect.unsafe.implicits.global import java.util.concurrent.CountDownLatch import java.util.concurrent.TimeUnit import kyo.* -import kyo.debug.Debug import kyo.kernel.Platform import org.scalatest.compatible.Assertion import org.scalatest.concurrent.Eventually.* import scala.concurrent.Future -import scala.concurrent.duration.* class CatsTest extends Test: diff --git a/kyo-combinators/shared/src/main/scala/kyo/Constructors.scala b/kyo-combinators/shared/src/main/scala/kyo/Constructors.scala index 9c71283f5..581ec19f2 100644 --- a/kyo-combinators/shared/src/main/scala/kyo/Constructors.scala +++ b/kyo-combinators/shared/src/main/scala/kyo/Constructors.scala @@ -5,7 +5,6 @@ import kyo.kernel.Boundary import kyo.kernel.Reducible import scala.annotation.tailrec import scala.concurrent.Future -import scala.reflect.ClassTag import scala.util.Failure import scala.util.NotGiven import scala.util.Success diff --git a/kyo-combinators/shared/src/test/scala/kyo/ConstructorsTest.scala b/kyo-combinators/shared/src/test/scala/kyo/ConstructorsTest.scala index ab93e6c73..cead2091e 100644 --- a/kyo-combinators/shared/src/test/scala/kyo/ConstructorsTest.scala +++ b/kyo-combinators/shared/src/test/scala/kyo/ConstructorsTest.scala @@ -1,6 +1,5 @@ package kyo -import scala.concurrent.Future import scala.util.Failure import scala.util.Success diff --git a/kyo-combinators/shared/src/test/scala/kyo/EnvCombinatorTest.scala b/kyo-combinators/shared/src/test/scala/kyo/EnvCombinatorTest.scala index 3e083be55..a813046c8 100644 --- a/kyo-combinators/shared/src/test/scala/kyo/EnvCombinatorTest.scala +++ b/kyo-combinators/shared/src/test/scala/kyo/EnvCombinatorTest.scala @@ -73,7 +73,7 @@ class EnvCombinatorTest extends Test: layerInt, layerBool ) - val handledTyped: Int < (IO & Memo) = handled + val _: Int < (IO & Memo) = handled Memo.run(handled).map { result => assert(result == 23) } diff --git a/kyo-core/shared/src/main/scala/kyo/AllowUnsafe.scala b/kyo-core/shared/src/main/scala/kyo/AllowUnsafe.scala index 5bf9257ad..a6c579d53 100644 --- a/kyo-core/shared/src/main/scala/kyo/AllowUnsafe.scala +++ b/kyo-core/shared/src/main/scala/kyo/AllowUnsafe.scala @@ -1,7 +1,5 @@ package kyo -import kyo.Ansi.* -import kyo.kernel.Safepoint import scala.annotation.implicitNotFound @implicitNotFound(""" diff --git a/kyo-core/shared/src/main/scala/kyo/Async.scala b/kyo-core/shared/src/main/scala/kyo/Async.scala index f62be3d9f..6f4a47474 100644 --- a/kyo-core/shared/src/main/scala/kyo/Async.scala +++ b/kyo-core/shared/src/main/scala/kyo/Async.scala @@ -1,19 +1,13 @@ package kyo -import java.util.concurrent.atomic.AtomicInteger import kyo.Result.Panic import kyo.Tag -import kyo.internal.FiberPlatformSpecific import kyo.kernel.* import kyo.scheduler.* -import scala.annotation.implicitNotFound import scala.annotation.tailrec -import scala.collection.immutable.ArraySeq -import scala.concurrent.ExecutionContext import scala.concurrent.Future import scala.util.NotGiven import scala.util.control.NonFatal -import scala.util.control.NoStackTrace /** Represents an asynchronous computation effect. * diff --git a/kyo-core/shared/src/main/scala/kyo/Clock.scala b/kyo-core/shared/src/main/scala/kyo/Clock.scala index ddd2249f3..5d087fc84 100644 --- a/kyo-core/shared/src/main/scala/kyo/Clock.scala +++ b/kyo-core/shared/src/main/scala/kyo/Clock.scala @@ -1,15 +1,11 @@ package kyo import java.util.concurrent.Callable -import java.util.concurrent.Delayed -import java.util.concurrent.DelayQueue import java.util.concurrent.Executors import java.util.concurrent.ScheduledExecutorService import java.util.concurrent.TimeUnit -import java.util.concurrent.locks.LockSupport import kyo.Clock.Deadline import kyo.Clock.Stopwatch -import kyo.Result.Panic import kyo.scheduler.IOPromise import kyo.scheduler.util.Threads import scala.annotation.tailrec @@ -518,7 +514,6 @@ object Clock: /** WARNING: Low-level API meant for integrations, libraries, and performance-sensitive code. See AllowUnsafe for more details. */ abstract class Unsafe: - import AllowUnsafe.embrace.danger def now()(using AllowUnsafe): Instant diff --git a/kyo-core/shared/src/main/scala/kyo/Fiber.scala b/kyo-core/shared/src/main/scala/kyo/Fiber.scala index b4a36aa8e..30216b628 100644 --- a/kyo-core/shared/src/main/scala/kyo/Fiber.scala +++ b/kyo-core/shared/src/main/scala/kyo/Fiber.scala @@ -7,7 +7,6 @@ import kyo.Tag import kyo.internal.FiberPlatformSpecific import kyo.kernel.* import kyo.scheduler.* -import scala.annotation.implicitNotFound import scala.annotation.tailrec import scala.collection.immutable.ArraySeq import scala.concurrent.ExecutionContext @@ -179,7 +178,6 @@ object Fiber extends FiberPlatformSpecific: * A new Fiber with the mapped result */ def map[B: Flat](f: A => B < IO)(using Frame): Fiber[E, B] < IO = - import AllowUnsafe.embrace.danger IO.Unsafe(Unsafe.map(self)((r => IO.Unsafe.run(f(r)).eval))) /** Flat maps the result of the Fiber. @@ -190,7 +188,6 @@ object Fiber extends FiberPlatformSpecific: * A new Fiber with the flat mapped result */ def flatMap[E2, B](f: A => Fiber[E2, B] < IO)(using Frame): Fiber[E | E2, B] < IO = - import AllowUnsafe.embrace.danger IO.Unsafe(Unsafe.flatMap(self)(r => IO.Unsafe.run(f(r)).eval)) /** Maps the Result of the Fiber using the provided function. diff --git a/kyo-core/shared/src/main/scala/kyo/Meter.scala b/kyo-core/shared/src/main/scala/kyo/Meter.scala index 716706bab..44977c473 100644 --- a/kyo-core/shared/src/main/scala/kyo/Meter.scala +++ b/kyo-core/shared/src/main/scala/kyo/Meter.scala @@ -71,8 +71,6 @@ end Meter object Meter: - import internal.* - /** A no-op Meter that always allows operations and can't be closed. */ case object Noop extends Meter: def availablePermits(using Frame) = Int.MaxValue diff --git a/kyo-core/shared/src/test/scala/kyo/AsyncTest.scala b/kyo-core/shared/src/test/scala/kyo/AsyncTest.scala index f1c18fa5a..9b533b606 100644 --- a/kyo-core/shared/src/test/scala/kyo/AsyncTest.scala +++ b/kyo-core/shared/src/test/scala/kyo/AsyncTest.scala @@ -344,7 +344,6 @@ class AsyncTest extends Test: "fromFuture" - { import scala.concurrent.Future - import scala.concurrent.ExecutionContext.Implicits.global "success" in run { val future = Future.successful(42) @@ -444,6 +443,7 @@ class AsyncTest extends Test: "parallel" in pendingUntilFixed { val v: Int < Abort[Int] = 1 + discard(v) assertCompiles("Async.parallel(Async.run(v), Async.run(v))") assertCompiles("Async.parallel(Async.runAndBlock(1.second)(v), Async.runAndBlock(1.second)(v))") assertCompiles("Async.parallel(Async.mask(v), Async.mask(v))") @@ -454,6 +454,7 @@ class AsyncTest extends Test: "race" in pendingUntilFixed { val v: Int < Abort[Int] = 1 + discard(v) assertCompiles("Async.race(Async.run(v), Async.run(v))") assertCompiles("Async.race(Async.runAndBlock(1.second)(v), Async.runAndBlock(1.second)(v))") assertCompiles("Async.race(Async.mask(v), Async.mask(v))") @@ -464,6 +465,7 @@ class AsyncTest extends Test: "mask" in pendingUntilFixed { val v: Int < Abort[Int] = 1 + discard(v) assertCompiles("Async.mask(Async.run(v))") assertCompiles("Async.mask(Async.runAndBlock(1.second)(v))") assertCompiles("Async.mask(Async.mask(v))") @@ -474,6 +476,7 @@ class AsyncTest extends Test: "timeout" in pendingUntilFixed { val v: Int < Abort[Int] = 1 + discard(v) assertCompiles("Async.timeout(1.second)(Async.run(v))") assertCompiles("Async.timeout(1.second)(Async.runAndBlock(1.second)(v))") assertCompiles("Async.timeout(1.second)(Async.mask(v))") @@ -484,6 +487,7 @@ class AsyncTest extends Test: "runAndBlock" in pendingUntilFixed { val v: Int < Abort[Int] = 1 + discard(v) assertCompiles("Async.runAndBlock(1.second)(Async.run(v))") assertCompiles("Async.runAndBlock(1.second)(Async.runAndBlock(1.second)(v))") assertCompiles("Async.runAndBlock(1.second)(Async.mask(v))") diff --git a/kyo-core/shared/src/test/scala/kyo/ClockTest.scala b/kyo-core/shared/src/test/scala/kyo/ClockTest.scala index 068d9712a..501f19bab 100644 --- a/kyo-core/shared/src/test/scala/kyo/ClockTest.scala +++ b/kyo-core/shared/src/test/scala/kyo/ClockTest.scala @@ -1,9 +1,7 @@ package kyo -import java.time.temporal.ChronoUnit import kyo.Clock.Deadline import kyo.Clock.Stopwatch -import kyo.Clock.stopwatch class ClockTest extends Test: diff --git a/kyo-core/shared/src/test/scala/kyo/FiberTest.scala b/kyo-core/shared/src/test/scala/kyo/FiberTest.scala index 732f4c81c..d6b076cc7 100644 --- a/kyo-core/shared/src/test/scala/kyo/FiberTest.scala +++ b/kyo-core/shared/src/test/scala/kyo/FiberTest.scala @@ -1,6 +1,5 @@ package kyo -import java.io.Closeable import java.util.concurrent.atomic.AtomicInteger as JAtomicInteger import org.scalatest.compatible.Assertion @@ -308,7 +307,6 @@ class FiberTest extends Test: "fromFuture" - { import scala.concurrent.Future - import scala.concurrent.ExecutionContext.Implicits.global "success" in run { val future = Future.successful(42) @@ -635,7 +633,6 @@ class FiberTest extends Test: "fromFuture" in run { import scala.concurrent.Future - import scala.concurrent.ExecutionContext.Implicits.global val future = Future.successful(42) val fiber = Fiber.Unsafe.fromFuture(future) diff --git a/kyo-core/shared/src/test/scala/kyo/KyoAppTest.scala b/kyo-core/shared/src/test/scala/kyo/KyoAppTest.scala index 9d8b03343..9c8e01a04 100644 --- a/kyo-core/shared/src/test/scala/kyo/KyoAppTest.scala +++ b/kyo-core/shared/src/test/scala/kyo/KyoAppTest.scala @@ -1,9 +1,6 @@ package kyo import Tagged.* -import kyo.Clock.Deadline -import kyo.Clock.Stopwatch -import kyo.Clock.Unsafe class KyoAppTest extends Test: diff --git a/kyo-core/shared/src/test/scala/kyo/TagCompactTest.scala b/kyo-core/shared/src/test/scala/kyo/TagCompactTest.scala index 58ea24c1f..86fb2f9db 100644 --- a/kyo-core/shared/src/test/scala/kyo/TagCompactTest.scala +++ b/kyo-core/shared/src/test/scala/kyo/TagCompactTest.scala @@ -1,7 +1,6 @@ package kyo import kyo.kernel.* -import org.scalatest.NonImplicitAssertions import org.scalatest.compatible.Assertion class TagCompactTest extends Test: diff --git a/kyo-data/shared/src/main/scala/kyo/Flat.scala b/kyo-data/shared/src/main/scala/kyo/Flat.scala index b41396a68..bc44f499b 100644 --- a/kyo-data/shared/src/main/scala/kyo/Flat.scala +++ b/kyo-data/shared/src/main/scala/kyo/Flat.scala @@ -1,8 +1,6 @@ package kyo -import scala.annotation.implicitNotFound import scala.quoted.* -import scala.util.NotGiven opaque type Flat[A] = Null diff --git a/kyo-data/shared/src/main/scala/kyo/Frame.scala b/kyo-data/shared/src/main/scala/kyo/Frame.scala index f2e88ee17..5a1fc50fa 100644 --- a/kyo-data/shared/src/main/scala/kyo/Frame.scala +++ b/kyo-data/shared/src/main/scala/kyo/Frame.scala @@ -1,6 +1,5 @@ package kyo -import kyo.Ansi import kyo.Maybe import scala.annotation.tailrec import scala.quoted.* diff --git a/kyo-data/shared/src/main/scala/kyo/Instant.scala b/kyo-data/shared/src/main/scala/kyo/Instant.scala index 37afab032..6120e5473 100644 --- a/kyo-data/shared/src/main/scala/kyo/Instant.scala +++ b/kyo-data/shared/src/main/scala/kyo/Instant.scala @@ -3,7 +3,6 @@ package kyo import java.time.DateTimeException import java.time.Instant as JInstant import java.time.format.DateTimeParseException -import java.time.temporal.ChronoUnit /** Represents a point in time with nanosecond precision by wrapping 'java.time.Instant'. * diff --git a/kyo-data/shared/src/main/scala/kyo/Result.scala b/kyo-data/shared/src/main/scala/kyo/Result.scala index d91400e0c..b9f7bbfe4 100644 --- a/kyo-data/shared/src/main/scala/kyo/Result.scala +++ b/kyo-data/shared/src/main/scala/kyo/Result.scala @@ -3,7 +3,6 @@ package kyo import Result.* import scala.annotation.implicitNotFound import scala.annotation.targetName -import scala.reflect.ClassTag import scala.util.Try import scala.util.control.NonFatal diff --git a/kyo-data/shared/src/main/scala/kyo/SafeClassTag.scala b/kyo-data/shared/src/main/scala/kyo/SafeClassTag.scala index 13496f76c..0b4683989 100644 --- a/kyo-data/shared/src/main/scala/kyo/SafeClassTag.scala +++ b/kyo-data/shared/src/main/scala/kyo/SafeClassTag.scala @@ -2,7 +2,6 @@ package kyo import kyo.Maybe import kyo.internal.SafeClassTagMacro -import scala.annotation.tailrec import scala.quoted.* /** An alternative to ClassTag that supports union and intersection types. diff --git a/kyo-data/shared/src/main/scala/kyo/Schedule.scala b/kyo-data/shared/src/main/scala/kyo/Schedule.scala index cd13742d7..c96fc3ead 100644 --- a/kyo-data/shared/src/main/scala/kyo/Schedule.scala +++ b/kyo-data/shared/src/main/scala/kyo/Schedule.scala @@ -2,7 +2,6 @@ package kyo import Schedule.internal.* import kyo.Duration -import kyo.Instant /** An immutable, composable scheduling policy. * diff --git a/kyo-direct/shared/src/test/scala/kyo/DirectTest.scala b/kyo-direct/shared/src/test/scala/kyo/DirectTest.scala index b17825e93..b7956f1ed 100644 --- a/kyo-direct/shared/src/test/scala/kyo/DirectTest.scala +++ b/kyo-direct/shared/src/test/scala/kyo/DirectTest.scala @@ -1,7 +1,5 @@ package kyo -import kyo.Console.Unsafe - class DirectTest extends Test: // "match" in { diff --git a/kyo-prelude/jvm/src/test/scala/kyo/kernel/SafepointTest.scala b/kyo-prelude/jvm/src/test/scala/kyo/kernel/SafepointTest.scala index 381663a78..a85b2a225 100644 --- a/kyo-prelude/jvm/src/test/scala/kyo/kernel/SafepointTest.scala +++ b/kyo-prelude/jvm/src/test/scala/kyo/kernel/SafepointTest.scala @@ -764,8 +764,4 @@ class SafepointTest extends Test: } } - private def createStateWithThreadId(threadId: Long): Safepoint.State = - val raw = (threadId << 32) | (Safepoint.State.init().depth & 0xffffffffL) - raw.asInstanceOf[Safepoint.State] - end SafepointTest diff --git a/kyo-prelude/shared/src/main/scala/kyo/Abort.scala b/kyo-prelude/shared/src/main/scala/kyo/Abort.scala index 2f52af9c8..ffa19934e 100644 --- a/kyo-prelude/shared/src/main/scala/kyo/Abort.scala +++ b/kyo-prelude/shared/src/main/scala/kyo/Abort.scala @@ -6,7 +6,6 @@ import kyo.Tag import kyo.kernel.Effect import kyo.kernel.Reducible import scala.annotation.targetName -import scala.reflect.ClassTag /** The Abort effect allows for short-circuiting computations with failure values. This effect is used for handling errors and early * termination scenarios in a functional manner and handle thrown exceptions. diff --git a/kyo-prelude/shared/src/main/scala/kyo/kernel/ArrowEffect.scala b/kyo-prelude/shared/src/main/scala/kyo/kernel/ArrowEffect.scala index f6d30f41f..1ba18a9ce 100644 --- a/kyo-prelude/shared/src/main/scala/kyo/kernel/ArrowEffect.scala +++ b/kyo-prelude/shared/src/main/scala/kyo/kernel/ArrowEffect.scala @@ -6,7 +6,6 @@ import kyo.Flat import kyo.Frame import kyo.Tag import scala.annotation.nowarn -import scala.annotation.tailrec import scala.util.control.NonFatal /** Represents abstract functions whose implementations are provided later by a handler. @@ -415,7 +414,7 @@ object ArrowEffect: )( inline handle: [C] => (I[C], Safepoint ?=> O[C] => A < (E & S & S2)) => A < (E & S & S2), inline done: A => B < S3 = (v: A) => v, - inline accept: [C] => I[C] => Boolean = [C] => (v: I[C]) => true, + inline accept: [C] => I[C] => Boolean = [C] => (_: I[C]) => true, inline recover: Throwable => B < (S & S2 & S3) )( using diff --git a/kyo-prelude/shared/src/main/scala/kyo/kernel/Effect.scala b/kyo-prelude/shared/src/main/scala/kyo/kernel/Effect.scala index a91c57ecf..877bd6944 100644 --- a/kyo-prelude/shared/src/main/scala/kyo/kernel/Effect.scala +++ b/kyo-prelude/shared/src/main/scala/kyo/kernel/Effect.scala @@ -2,7 +2,6 @@ package kyo.kernel import internal.* import kyo.Frame -import kyo.Tag import scala.annotation.nowarn import scala.util.control.NonFatal diff --git a/kyo-prelude/shared/src/main/scala/kyo/kernel/Safepoint.scala b/kyo-prelude/shared/src/main/scala/kyo/kernel/Safepoint.scala index 9f59f207a..759993e54 100644 --- a/kyo-prelude/shared/src/main/scala/kyo/kernel/Safepoint.scala +++ b/kyo-prelude/shared/src/main/scala/kyo/kernel/Safepoint.scala @@ -1,6 +1,5 @@ package kyo.kernel -import Safepoint.State import internal.* import java.util.concurrent.atomic.AtomicBoolean import kyo.Frame diff --git a/kyo-scheduler/jvm/src/main/scala/kyo/scheduler/Scheduler.scala b/kyo-scheduler/jvm/src/main/scala/kyo/scheduler/Scheduler.scala index 11ae44d3a..169efd7d1 100644 --- a/kyo-scheduler/jvm/src/main/scala/kyo/scheduler/Scheduler.scala +++ b/kyo-scheduler/jvm/src/main/scala/kyo/scheduler/Scheduler.scala @@ -6,7 +6,6 @@ import java.util.concurrent.Executor import java.util.concurrent.Executors import java.util.concurrent.ScheduledExecutorService import java.util.concurrent.ThreadPoolExecutor -import java.util.concurrent.TimeUnit import java.util.concurrent.atomic.LongAdder import java.util.concurrent.locks.LockSupport import kyo.scheduler.regulator.Admission diff --git a/kyo-scheduler/jvm/src/main/scala/kyo/scheduler/regulator/Regulator.scala b/kyo-scheduler/jvm/src/main/scala/kyo/scheduler/regulator/Regulator.scala index 1fed42287..e2b5ed7d1 100644 --- a/kyo-scheduler/jvm/src/main/scala/kyo/scheduler/regulator/Regulator.scala +++ b/kyo-scheduler/jvm/src/main/scala/kyo/scheduler/regulator/Regulator.scala @@ -76,8 +76,9 @@ abstract class Regulator( } def stop(): Unit = { - val ign = collectTask.cancel() - val _ = regulateTask.cancel() + def discard(v: Any) = {} + discard(collectTask.cancel()) + discard(regulateTask.cancel()) } protected val statsScope = kyo.scheduler.statsScope.scope("regulator", getClass.getSimpleName().toLowerCase()) diff --git a/kyo-zio/shared/src/main/scala/kyo/ZIOs.scala b/kyo-zio/shared/src/main/scala/kyo/ZIOs.scala index 26f6a5bbc..528db40b4 100644 --- a/kyo-zio/shared/src/main/scala/kyo/ZIOs.scala +++ b/kyo-zio/shared/src/main/scala/kyo/ZIOs.scala @@ -1,17 +1,14 @@ package kyo import kyo.kernel.* -import scala.concurrent.ExecutionContext import scala.util.control.NonFatal import zio.Exit import zio.FiberId import zio.Runtime import zio.Unsafe import zio.ZIO -import zio.stacktracer.TracingImplicits.disableAutoTrace object ZIOs: - import internal.* /** Lifts a zio.ZIO into a Kyo effect. *