mirror of https://github.com/sbt/sbt.git
Add -Ywarn-unused & -Ywarn-unused-import, & fix warnings
This commit is contained in:
parent
5f2e56a5a8
commit
8cc4a54c40
|
|
@ -94,7 +94,6 @@ object Dag {
|
||||||
*/
|
*/
|
||||||
private[sbt] def findNegativeCycle[Node](graph: DirectedSignedGraph[Node]): List[graph.Arrow] =
|
private[sbt] def findNegativeCycle[Node](graph: DirectedSignedGraph[Node]): List[graph.Arrow] =
|
||||||
{
|
{
|
||||||
import scala.annotation.tailrec
|
|
||||||
import graph._
|
import graph._
|
||||||
val finished = new mutable.HashSet[Node]
|
val finished = new mutable.HashSet[Node]
|
||||||
val visited = new mutable.HashSet[Node]
|
val visited = new mutable.HashSet[Node]
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ package sbt.internal.util
|
||||||
import java.lang.Runnable
|
import java.lang.Runnable
|
||||||
import java.util.concurrent.{ atomic, Executor, LinkedBlockingQueue }
|
import java.util.concurrent.{ atomic, Executor, LinkedBlockingQueue }
|
||||||
import atomic.{ AtomicBoolean, AtomicInteger }
|
import atomic.{ AtomicBoolean, AtomicInteger }
|
||||||
import Types.{ :+:, ConstK, Id }
|
import Types.{ ConstK, Id }
|
||||||
|
|
||||||
object EvaluationState extends Enumeration {
|
object EvaluationState extends Enumeration {
|
||||||
val New, Blocked, Ready, Calling, Evaluated = Value
|
val New, Blocked, Ready, Calling, Evaluated = Value
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,6 @@
|
||||||
*/
|
*/
|
||||||
package sbt.internal.util
|
package sbt.internal.util
|
||||||
|
|
||||||
import Types._
|
|
||||||
|
|
||||||
// Used to emulate ~> literals
|
// Used to emulate ~> literals
|
||||||
trait Param[A[_], B[_]] {
|
trait Param[A[_], B[_]] {
|
||||||
type T
|
type T
|
||||||
|
|
|
||||||
|
|
@ -278,7 +278,6 @@ trait Init[Scope] {
|
||||||
|
|
||||||
def flattenLocals(compiled: CompiledMap): Map[ScopedKey[_], Flattened] =
|
def flattenLocals(compiled: CompiledMap): Map[ScopedKey[_], Flattened] =
|
||||||
{
|
{
|
||||||
import collection.breakOut
|
|
||||||
val locals = compiled flatMap { case (key, comp) => if (key.key.isLocal) Seq[Compiled[_]](comp) else Nil }
|
val locals = compiled flatMap { case (key, comp) => if (key.key.isLocal) Seq[Compiled[_]](comp) else Nil }
|
||||||
val ordered = Dag.topologicalSort(locals)(_.dependencies.flatMap(dep => if (dep.key.isLocal) Seq[Compiled[_]](compiled(dep)) else Nil))
|
val ordered = Dag.topologicalSort(locals)(_.dependencies.flatMap(dep => if (dep.key.isLocal) Seq[Compiled[_]](compiled(dep)) else Nil))
|
||||||
def flatten(cmap: Map[ScopedKey[_], Flattened], key: ScopedKey[_], deps: Iterable[ScopedKey[_]]): Flattened =
|
def flatten(cmap: Map[ScopedKey[_], Flattened], key: ScopedKey[_], deps: Iterable[ScopedKey[_]]): Flattened =
|
||||||
|
|
@ -340,11 +339,6 @@ trait Init[Scope] {
|
||||||
derivsByDef.getOrElseUpdate(key, new Deriveds(key, new mutable.ListBuffer)).settings += s
|
derivsByDef.getOrElseUpdate(key, new Deriveds(key, new mutable.ListBuffer)).settings += s
|
||||||
}
|
}
|
||||||
|
|
||||||
// sort derived settings so that dependencies come first
|
|
||||||
// this is necessary when verifying that a derived setting's dependencies exist
|
|
||||||
val ddeps = (d: Deriveds) => d.dependencies.flatMap(derivsByDef.get)
|
|
||||||
val sortedDerivs = Dag.topologicalSort(derivsByDef.values)(ddeps)
|
|
||||||
|
|
||||||
// index derived settings by triggering key. This maps a key to the list of settings potentially derived from it.
|
// index derived settings by triggering key. This maps a key to the list of settings potentially derived from it.
|
||||||
val derivedBy = new mutable.HashMap[AttributeKey[_], mutable.ListBuffer[Derived]]
|
val derivedBy = new mutable.HashMap[AttributeKey[_], mutable.ListBuffer[Derived]]
|
||||||
for (s <- derived; d <- s.triggeredBy)
|
for (s <- derived; d <- s.triggeredBy)
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,6 @@
|
||||||
*/
|
*/
|
||||||
package sbt.internal.util
|
package sbt.internal.util
|
||||||
|
|
||||||
import Types._
|
|
||||||
|
|
||||||
// compilation test
|
// compilation test
|
||||||
object LiteralTest {
|
object LiteralTest {
|
||||||
def x[A[_], B[_]](f: A ~> B) = f
|
def x[A[_], B[_]](f: A ~> B) = f
|
||||||
|
|
@ -14,4 +12,4 @@ object LiteralTest {
|
||||||
|
|
||||||
val a: List[Int] = f(Some(3))
|
val a: List[Int] = f(Some(3))
|
||||||
val b: List[String] = f(Some("aa"))
|
val b: List[String] = f(Some("aa"))
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,6 @@ object SettingsExample extends Init[Scope] {
|
||||||
|
|
||||||
object SettingsUsage {
|
object SettingsUsage {
|
||||||
import SettingsExample._
|
import SettingsExample._
|
||||||
import Types._
|
|
||||||
|
|
||||||
// Define some keys
|
// Define some keys
|
||||||
val a = AttributeKey[Int]("a")
|
val a = AttributeKey[Int]("a")
|
||||||
|
|
|
||||||
|
|
@ -5,9 +5,8 @@ package sbt.internal.util
|
||||||
|
|
||||||
import jline.console.ConsoleReader
|
import jline.console.ConsoleReader
|
||||||
import jline.console.history.{ FileHistory, MemoryHistory }
|
import jline.console.history.{ FileHistory, MemoryHistory }
|
||||||
import java.io.{ File, InputStream, PrintWriter, FileInputStream, FileDescriptor, FilterInputStream }
|
import java.io.{ File, InputStream, FileInputStream, FileDescriptor, FilterInputStream }
|
||||||
import complete.Parser
|
import complete.Parser
|
||||||
import java.util.concurrent.atomic.AtomicBoolean
|
|
||||||
import scala.concurrent.duration.Duration
|
import scala.concurrent.duration.Duration
|
||||||
import scala.annotation.tailrec
|
import scala.annotation.tailrec
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,6 @@ object EditDistance {
|
||||||
for (i <- 1 to n; s_i = s(i - 1); j <- 1 to m) {
|
for (i <- 1 to n; s_i = s(i - 1); j <- 1 to m) {
|
||||||
val t_j = t(j - 1)
|
val t_j = t(j - 1)
|
||||||
val cost = if (s_i == t_j) matchCost else if (lower(s_i) == lower(t_j)) caseCost else subCost
|
val cost = if (s_i == t_j) matchCost else if (lower(s_i) == lower(t_j)) caseCost else subCost
|
||||||
val tcost = if (s_i == t_j) matchCost else transposeCost
|
|
||||||
|
|
||||||
val c1 = d(i - 1)(j) + deleteCost
|
val c1 = d(i - 1)(j) + deleteCost
|
||||||
val c2 = d(i)(j - 1) + insertCost
|
val c2 = d(i)(j - 1) + insertCost
|
||||||
|
|
@ -39,4 +38,4 @@ object EditDistance {
|
||||||
|
|
||||||
d(n)(m)
|
d(n)(m)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,6 @@
|
||||||
package sbt.internal.util
|
package sbt.internal.util
|
||||||
package complete
|
package complete
|
||||||
|
|
||||||
import java.io.File
|
|
||||||
import sbt.io.IO
|
import sbt.io.IO
|
||||||
|
|
||||||
object HistoryCommands {
|
object HistoryCommands {
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ package sbt.internal.util
|
||||||
package complete
|
package complete
|
||||||
|
|
||||||
import jline.console.ConsoleReader
|
import jline.console.ConsoleReader
|
||||||
import jline.console.completer.{ CandidateListCompletionHandler, Completer, CompletionHandler }
|
import jline.console.completer.{ Completer, CompletionHandler }
|
||||||
import scala.annotation.tailrec
|
import scala.annotation.tailrec
|
||||||
import collection.JavaConversions
|
import collection.JavaConversions
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue