remove unnecessary nowarn annotations

This commit is contained in:
xuwei-k 2025-10-04 19:25:04 +09:00
parent 028248f73e
commit 038fa6c476
12 changed files with 1 additions and 33 deletions

View File

@ -3,7 +3,6 @@
*/
package sbt.librarymanagement
import scala.annotation.nowarn
import scala.quoted.*
object Configurations {
@ -23,7 +22,6 @@ object Configurations {
lazy val TestInternal = fullInternal(Test)
lazy val CompileInternal = fullInternal(Compile)
@nowarn
def internalMap(c: Configuration) = c match {
case Compile => CompileInternal
case Test => TestInternal
@ -62,7 +60,6 @@ object Configurations {
configs.map(config => (config.name, config)).toMap.values.toSet
/** Returns true if the configuration should be under the influence of scalaVersion. */
@nowarn
private[sbt] def underScalaVersion(c: Configuration): Boolean =
c match {
case Default | Compile | Provided | Runtime | Test | Optional | CompilerPlugin |

View File

@ -22,7 +22,6 @@ import java.net.URLEncoder
import java.nio.charset.StandardCharsets
import java.nio.file.Path
import java.util.Base64
import scala.annotation.nowarn
import scala.concurrent.*
import scala.concurrent.duration.*
@ -145,7 +144,6 @@ class SonaClient(reqTransform: Request => Request, uploadRequestTimeout: FiniteD
/**
* Retry future function on any error.
*/
@nowarn
private def retryF[A1](maxAttempt: Int, waitDurationBetweenAttempt: FiniteDuration)(
f: Int => Future[A1]
): Future[A1] = {

View File

@ -11,7 +11,6 @@ package test
import java.io.File
import hedgehog.*
import scala.annotation.nowarn
import scala.reflect.ClassTag
import _root_.sbt.io.IO
import _root_.sbt.ScopeAxis.{ Select, This, Zero }
@ -46,7 +45,6 @@ object BuildSettingsInstances:
1133 -> genRootProject.map(x => x: Reference),
)
@nowarn
given Gen[ConfigKey] = Gen.frequency1(
2 -> Gen.constant[ConfigKey](Compile),
2 -> Gen.constant[ConfigKey](Test),

View File

@ -1283,7 +1283,6 @@ object Defaults extends BuildCommon {
)
}
@nowarn
def inputTests(key: InputKey[?]): Initialize[InputTask[TestResult]] =
inputTests0.mapReferenced(Def.mapScope((s) => s.rescope(key.key)))
@ -4564,7 +4563,6 @@ trait BuildExtra extends BuildCommon with DefExtra {
// public API
/** Returns a vector of settings that create custom run input task. */
@nowarn
def fullRunInputTask(
scoped: InputKey[Unit],
config: Configuration,

View File

@ -24,7 +24,6 @@ import sbt.nio.file.syntax.pathToPathOps
import sbt.nio.file.Glob.{ GlobOps }
import sbt.util.Level
import sjsonnew.JsonFormat
import scala.annotation.nowarn
import xsbti.{ PathBasedFile, VirtualFileRef }
private[sbt] object Clean {
@ -155,7 +154,6 @@ private[sbt] object Clean {
private def toSeqPath(using toSeqPath: ToSeqPath[T]): Seq[Path] = toSeqPath(t)
}
@nowarn
private[sbt] def cleanFileOutputTask[T: JsonFormat: ToSeqPath](
taskKey: TaskKey[T]
): Def.Initialize[Task[Unit]] =

View File

@ -45,7 +45,6 @@ import scala.concurrent.duration.FiniteDuration.FiniteDurationIsOrdered
import scala.concurrent.duration.*
import scala.util.{ Failure, Success, Try }
import scala.util.control.NonFatal
import scala.annotation.nowarn
/**
* Provides the implementation of the `~` command and `watch` task. The implementation is quite
@ -394,7 +393,6 @@ private[sbt] object Continuous {
}
}
@nowarn
private def getOnStart(
project: ProjectRef,
commands: Seq[String],
@ -428,7 +426,6 @@ private[sbt] object Continuous {
}
}
@nowarn
private def getFileEvents(
configs: Seq[Config],
logger: Logger,
@ -977,13 +974,11 @@ private[sbt] object Continuous {
def arguments(logger: Logger): Arguments = new Arguments(logger, inputs())
end Config
@nowarn
private def getStartMessage(key: ScopedKey[?])(using Extracted): StartMessage = Some {
lazy val default = key.get(watchStartMessage).getOrElse(Watch.defaultStartWatch)
default
}
@nowarn
private def getTriggerMessage(
key: ScopedKey[?]
)(using Extracted): TriggerMessage = {

View File

@ -26,7 +26,6 @@ import sbt.librarymanagement.LibraryManagementCodec.given
import java.io.File
import org.apache.ivy.core.module.{ descriptor, id }
import descriptor.ModuleDescriptor, id.ModuleRevisionId
import scala.annotation.nowarn
object GlobalPlugin {
// constructs a sequence of settings that may be appended to a project's settings to
@ -71,7 +70,6 @@ object GlobalPlugin {
GlobalPlugin(data, structure, inject(data), base)
}
@nowarn
def extract(state: State, structure: BuildStructure): (State, GlobalPluginData) = {
import structure.{ data, root, rootProject }
val p: Scope = Scope.GlobalScope.rescope(ProjectRef(root, rootProject(root)))
@ -112,7 +110,6 @@ object GlobalPlugin {
}
}
@nowarn
val globalPluginSettings = Project.inScope(Scope.GlobalScope.rescope(LocalRootProject))(
Seq(
organization := SbtArtifacts.Organization,

View File

@ -22,7 +22,6 @@ import sbt.io.syntax.*
import sbt.ProjectExtra.*
import sjsonnew.JsonFormat
import scala.concurrent.duration.FiniteDuration
import scala.annotation.nowarn
private[sbt] object LibraryManagement {
given linter: sbt.dsl.LinterLevel.Ignore.type = sbt.dsl.LinterLevel.Ignore
@ -251,7 +250,6 @@ private[sbt] object LibraryManagement {
* Resolves and optionally retrieves classified artifacts, such as javadocs and sources,
* for dependency definitions, transitively.
*/
@nowarn
def updateClassifiersTask: Def.Initialize[Task[UpdateReport]] =
TupleWrap[
(

View File

@ -4,7 +4,6 @@ package internal
import sbt.internal.util.complete.{ DefaultParsers, Parser }
import sbt.Keys.scalaBinaryVersion
import DefaultParsers.*
import scala.annotation.nowarn
import scala.util.matching.Regex
import sbt.internal.util.AttributeKey
@ -15,7 +14,6 @@ private[sbt] case class ProjectQuery(
import ProjectQuery.*
private lazy val pattern: Regex = Regex("^" + projectName.replace(wildcard, ".*") + "$")
@nowarn
def buildQuery(structure: BuildStructure): ProjectRef => Boolean =
(p: ProjectRef) =>
val projectMatches =

View File

@ -21,7 +21,7 @@ import sbt.nio.FileStamper
import sbt.nio.Keys.*
import sbt.nio.file.Glob
import scala.annotation.{ nowarn, tailrec }
import scala.annotation.tailrec
private[sbt] object WatchTransitiveDependencies {
extension (source: Source) {
@ -165,7 +165,6 @@ private[sbt] object WatchTransitiveDependencies {
}
}
@nowarn
@tailrec
private def collectKeys(
arguments: Arguments,

View File

@ -25,7 +25,6 @@ import sbt.nio.file.{ AllPass, FileAttributes, Glob, RecursiveGlob }
import sbt.std.TaskExtra.*
import sjsonnew.JsonFormat
import scala.annotation.nowarn
import scala.collection.immutable.VectorBuilder
import java.io.File
import xsbti.VirtualFileRef
@ -67,7 +66,6 @@ private[sbt] object Settings {
* @param fileOutputScopes the set of scopes for which the fileOutputs setting is defined
* @return the injected settings
*/
@nowarn
private def maybeAddOutputsAndFileStamps(
setting: Def.Setting[?],
fileOutputScopes: Set[Scope]
@ -90,7 +88,6 @@ private[sbt] object Settings {
}
}
@nowarn
private def addDefaultTasks(
setting: Def.Setting[?],
fileOutputScopes: Set[Scope]
@ -105,7 +102,6 @@ private[sbt] object Settings {
} else Nil
}
@nowarn
private def addOutputAndStampTasks[T: JsonFormat: ToSeqPath](
setting: Def.Setting[?]
): List[Def.Setting[?]] = {
@ -271,7 +267,6 @@ private[sbt] object Settings {
* @param taskKey the task for which we add a custom clean implementation
* @return a task specific clean implementation
*/
@nowarn
private[sbt] def cleanImpl[T: JsonFormat: ToSeqPath](taskKey: TaskKey[T]): Def.Setting[?] = {
val taskScope = taskKey.scope.rescope(taskKey.key)
addTaskDefinition(
@ -326,7 +321,6 @@ private[sbt] object Settings {
})
}
@nowarn
private def outputsAndStamps[T: JsonFormat: ToSeqPath](
taskKey: TaskKey[T]
): List[Def.Setting[?]] = {

View File

@ -19,7 +19,6 @@ import sbt.ProjectExtra.inConfig
import sbt.internal.*
import sbt.io.syntax.*
import sbt.librarymanagement.Configurations.Test
import scala.annotation.nowarn
/**
* An experimental plugin that adds the ability for junit-xml to be generated.
@ -54,7 +53,6 @@ object JUnitXmlReportPlugin extends AutoPlugin {
import autoImport.*
@nowarn
override lazy val projectSettings: Seq[Setting[?]] =
inConfig(Test)(testReportSettings)
}