From 9a0e38b14f76f05bdb0a086c7ad73b0ba95ec6c9 Mon Sep 17 00:00:00 2001 From: Vladislav Ugryumov Date: Wed, 22 Nov 2023 13:03:02 +0300 Subject: [PATCH] Fixed warnings. --- .../main/scala-2/tofu/example/logging/auto/AutoLogs.scala | 2 +- .../scala-2/tofu/example/logging/service/ServiceLogs.scala | 2 +- .../scala-2/tofu/example/logging/simple/SimpleLogs.scala | 2 +- modules/core/ce2/src/test/scala/tofu/ScopedSuite.scala | 7 ++++--- .../src/main/scala-2/tofu/concurrent/ContextT.scala | 7 ++++--- .../main/scala-2/tofu/logging/zlogs/ZioHasBuilder.scala | 2 +- .../structured/src/main/scala-2/tofu/logging/Logs.scala | 3 ++- .../src/test/scala-2/tofu/logging/LoggableSuite.scala | 2 +- .../tofu/logging/location/LocationSyntaxSuite.scala | 2 +- .../main/scala-2/tofu/observable/TakeWhileInclusive.scala | 5 +++-- 10 files changed, 19 insertions(+), 15 deletions(-) diff --git a/examples/ce2/src/main/scala-2/tofu/example/logging/auto/AutoLogs.scala b/examples/ce2/src/main/scala-2/tofu/example/logging/auto/AutoLogs.scala index 3bd6e003a..d2f50d72a 100644 --- a/examples/ce2/src/main/scala-2/tofu/example/logging/auto/AutoLogs.scala +++ b/examples/ce2/src/main/scala-2/tofu/example/logging/auto/AutoLogs.scala @@ -136,7 +136,7 @@ object CargoApp extends IOApp { implicit val logMakeTraced: Logging.Make[TracedIO] = Logging.Make.contextual[TracedIO, Trace] implicit val logMake: Logging.Make[IO] = Logging.Make.plain[IO] - implicit val appLogger = logMake.byName("CargoApp") + implicit val appLogger: Logging[IO] = logMake.byName("CargoApp") val endpoints = Endpoints.cargoEndpoints[IO, TracedIO]( CargoService.make(MovingCompany.make[TracedIO], Warehouse.makeSmall[TracedIO]) diff --git a/examples/ce2/src/main/scala-2/tofu/example/logging/service/ServiceLogs.scala b/examples/ce2/src/main/scala-2/tofu/example/logging/service/ServiceLogs.scala index 9e650e9a9..a41591734 100644 --- a/examples/ce2/src/main/scala-2/tofu/example/logging/service/ServiceLogs.scala +++ b/examples/ce2/src/main/scala-2/tofu/example/logging/service/ServiceLogs.scala @@ -126,7 +126,7 @@ object CargoApp extends IOApp { implicit val logMakeTraced: Logging.Make[TracedIO] = Logging.Make.contextual[TracedIO, Trace] implicit val logMake: Logging.Make[IO] = Logging.Make.plain[IO] - implicit val appLogger = logMake.byName("CargoApp") + implicit val appLogger: Logging[IO] = logMake.byName("CargoApp") val endpoints = Endpoints.cargoEndpoints[IO, TracedIO]( CargoService.make(MovingCompany.make[TracedIO], Warehouse.makeSmall[TracedIO]) diff --git a/examples/ce2/src/main/scala-2/tofu/example/logging/simple/SimpleLogs.scala b/examples/ce2/src/main/scala-2/tofu/example/logging/simple/SimpleLogs.scala index cca9696c9..407ec8941 100644 --- a/examples/ce2/src/main/scala-2/tofu/example/logging/simple/SimpleLogs.scala +++ b/examples/ce2/src/main/scala-2/tofu/example/logging/simple/SimpleLogs.scala @@ -136,7 +136,7 @@ object CargoApp extends IOApp { implicit val logMakeTraced: Logging.Make[TracedIO] = Logging.Make.contextual[TracedIO, Trace] implicit val logMake: Logging.Make[IO] = Logging.Make.plain[IO] - implicit val appLogger = logMake.byName("CargoApp") + implicit val appLogger: Logging[IO] = logMake.byName("CargoApp") val endpoints = Endpoints.cargoEndpoints[IO, TracedIO]( CargoService.make(MovingCompany.make[TracedIO], Warehouse.makeSmall[TracedIO]) diff --git a/modules/core/ce2/src/test/scala/tofu/ScopedSuite.scala b/modules/core/ce2/src/test/scala/tofu/ScopedSuite.scala index 370944e0a..9dd2db869 100644 --- a/modules/core/ce2/src/test/scala/tofu/ScopedSuite.scala +++ b/modules/core/ce2/src/test/scala/tofu/ScopedSuite.scala @@ -6,13 +6,14 @@ import scala.concurrent.ExecutionContext import cats.effect.Blocker import tofu.syntax.scoped.* import tofu.syntax.monadic.* -import tofu.compat.unused +import scala.annotation.nowarn import scala.concurrent.Future class ScopedSuite { + @nowarn("cat=unused-params") def doSomething[F[_]: ContextShift: Async, A](fa: F[A], ea: => A)(calcEc: ExecutionContext)(implicit - @unused ec: ExecutionContext, - @unused block: Blocker + ec: ExecutionContext, + block: Blocker ): F[List[A]] = { implicit val exec: CalcExec[F] = Scoped.makeExecuteCE2(calcEc) diff --git a/modules/core/concurrent-ce2/src/main/scala-2/tofu/concurrent/ContextT.scala b/modules/core/concurrent-ce2/src/main/scala-2/tofu/concurrent/ContextT.scala index 45a0f1614..8650a2e33 100644 --- a/modules/core/concurrent-ce2/src/main/scala-2/tofu/concurrent/ContextT.scala +++ b/modules/core/concurrent-ce2/src/main/scala-2/tofu/concurrent/ContextT.scala @@ -140,8 +140,8 @@ trait ContextTInstancesR extends ContextTInstancesS { self: ContextTInstances => final implicit def contextTContext[F[+_]: Applicative, C[_[_]]]: ContextTContext[F, C] = new ContextTContext - final implicit def contextTNonEmptyParallel[F[+_]: NonEmptyParallel, C[_[_]]: InvariantK] = - new ContextTNonEmptyParallelI[F, C] + final implicit def contextTNonEmptyParallel[F[+_]: NonEmptyParallel, C[_[_]]: InvariantK] + : ContextTNonEmptyParallelI[F, C] = new ContextTNonEmptyParallelI[F, C] } trait ContextTInstancesQ extends ContextTInstancesR { self: ContextTInstances => @@ -175,7 +175,8 @@ trait ContextTInstancesP extends ContextTInstancesQ { self: ContextTInstances => rc1: Rebase[In], ): Unlift[ContextT[F, In, *], ContextT[F, Out, *]] = { class uloi(implicit c2c: Out[ContextT[F, Out, *]]) extends Unlift[ContextT[F, Out, *], ContextT[F, In, *]] { - implicit def self = this + implicit def self: Unlift[ContextT[F, Out, *], ContextT[F, In, *]] = this + def lift[A](c2a: ContextT[F, Out, A]): ContextT[F, In, A] = c1c => c2a.run(l.set(c2c, rc1.rebase(c1c))) diff --git a/modules/interop/zio1/logging/src/main/scala-2/tofu/logging/zlogs/ZioHasBuilder.scala b/modules/interop/zio1/logging/src/main/scala-2/tofu/logging/zlogs/ZioHasBuilder.scala index 61ce2c3b2..d4155ff43 100644 --- a/modules/interop/zio1/logging/src/main/scala-2/tofu/logging/zlogs/ZioHasBuilder.scala +++ b/modules/interop/zio1/logging/src/main/scala-2/tofu/logging/zlogs/ZioHasBuilder.scala @@ -21,7 +21,7 @@ object ZioHasBuilder { class UnHas[U](val loggable: Loggable[U]) extends AnyVal object UnHas { - implicit def unHas[S: Tag](implicit S: Loggable[S]) = + implicit def unHas[S: Tag](implicit S: Loggable[S]): UnHas[Has[S]] = new UnHas[Has[S]](S.contramap(_.get)) } } diff --git a/modules/logging/structured/src/main/scala-2/tofu/logging/Logs.scala b/modules/logging/structured/src/main/scala-2/tofu/logging/Logs.scala index dc975db0d..a0e7445b1 100644 --- a/modules/logging/structured/src/main/scala-2/tofu/logging/Logs.scala +++ b/modules/logging/structured/src/main/scala-2/tofu/logging/Logs.scala @@ -135,5 +135,6 @@ object Logs extends LogsInstances with LogsInstances0 { } /** Set of useful syntax stuff for Logs */ - implicit def ops[I[_], F[_]](logs: Logs[I, F]) = new LogsInvariantSyntax.LogsOps[I, F](logs) + implicit def ops[I[_], F[_]](logs: Logs[I, F]): LogsInvariantSyntax.LogsOps[I, F] = + new LogsInvariantSyntax.LogsOps[I, F](logs) } diff --git a/modules/logging/structured/src/test/scala-2/tofu/logging/LoggableSuite.scala b/modules/logging/structured/src/test/scala-2/tofu/logging/LoggableSuite.scala index 97ce029e8..2b90942af 100644 --- a/modules/logging/structured/src/test/scala-2/tofu/logging/LoggableSuite.scala +++ b/modules/logging/structured/src/test/scala-2/tofu/logging/LoggableSuite.scala @@ -34,7 +34,7 @@ class LoggableSuite extends AnyFlatSpec with Matchers { json(TestInt(-1)) shouldBe """{"missing":null,"sign":"negative","value":-1}""" } - implicit val testLoggableEither = Loggable.either[String, Int].named("kek") + implicit val testLoggableEither: Loggable[Either[String, Int]] = Loggable.either[String, Int].named("kek") "either custom logging" should "handle left" in { json("lol".asLeft[Int]) shouldBe """{"kek":"lol"}""" diff --git a/modules/logging/structured/src/test/scala-2/tofu/logging/location/LocationSyntaxSuite.scala b/modules/logging/structured/src/test/scala-2/tofu/logging/location/LocationSyntaxSuite.scala index 20bc9bd5e..ca0d569e2 100644 --- a/modules/logging/structured/src/test/scala-2/tofu/logging/location/LocationSyntaxSuite.scala +++ b/modules/logging/structured/src/test/scala-2/tofu/logging/location/LocationSyntaxSuite.scala @@ -16,7 +16,7 @@ object WriterLogs extends Logs[Id, Writer[List[String], *]] { class TestService { type Run[A] = Writer[List[String], A] - implicit val logger = WriterLogs.byName("TestLogger") + implicit val logger: Logging[Writer[List[String], *]] = WriterLogs.byName("TestLogger") def sayHello(name: String): Run[String] = for { diff --git a/modules/util/observable/src/main/scala-2/tofu/observable/TakeWhileInclusive.scala b/modules/util/observable/src/main/scala-2/tofu/observable/TakeWhileInclusive.scala index 9a1fd09ee..87b84c26c 100644 --- a/modules/util/observable/src/main/scala-2/tofu/observable/TakeWhileInclusive.scala +++ b/modules/util/observable/src/main/scala-2/tofu/observable/TakeWhileInclusive.scala @@ -6,11 +6,12 @@ import monix.reactive.observers.Subscriber import scala.concurrent.Future import scala.util.control.NonFatal +import monix.execution.Scheduler //shameless copy of monix.reactive.internal.operators.TakeByPredicateOperator private[observable] final case class TakeWhileInclusive[A](p: A => Boolean, out: Subscriber[A]) extends Subscriber[A] { - implicit val scheduler = out.scheduler - private[this] var isActive = true + implicit val scheduler: Scheduler = out.scheduler + private[this] var isActive = true def onNext(elem: A): Future[Ack] = { if (!isActive) Stop