add `using` if explicitly providing arguments to methods defined with `implicit`

This commit is contained in:
xuwei-k 2025-05-09 20:11:43 +09:00
parent 84ebcd3c34
commit 74a4abf049
6 changed files with 9 additions and 11 deletions

View File

@ -37,7 +37,7 @@ private[sbt] object SbtRefactorings:
val split = SbtParser(FAKE_FILE, lines)
given ctx: Context = SbtParser.defaultGlobalForParser.compileCtx
val recordedCommands = recordCommands(commands, split)
val sortedRecordedCommands = recordedCommands.sortBy(_._1)(reverseOrderingInt)
val sortedRecordedCommands = recordedCommands.sortBy(_._1)(using reverseOrderingInt)
val newContent = replaceFromBottomToTop(lines.mkString(END_OF_LINE), sortedRecordedCommands)
newContent.linesIterator.toList

View File

@ -543,9 +543,7 @@ object Tests {
}
}
sequence(results.toList, List()) map { res =>
val (rs, ms) = res.unzip { e =>
(e.overall, e.events)
}
val (rs, ms) = res.unzip(using (e => (e.overall, e.events)))
val m = ms reduce { (m1: Map[String, SuiteResult], m2: Map[String, SuiteResult]) =>
Map((m1.toSeq ++ m2.toSeq)*)
}

View File

@ -3552,9 +3552,9 @@ object Classpaths {
import sjsonnew.support.scalajson.unsafe.*
val moduleIdFormat: JsonFormat[ModuleID] = implicitly[JsonFormat[ModuleID]]
def write(key: ModuleID): String =
CompactPrinter(Converter.toJsonUnsafe(key)(moduleIdFormat))
CompactPrinter(Converter.toJsonUnsafe(key)(using moduleIdFormat))
def read(key: String): ModuleID =
Converter.fromJsonUnsafe[ModuleID](Parser.parseUnsafe(key))(moduleIdFormat)
Converter.fromJsonUnsafe[ModuleID](Parser.parseUnsafe(key))(using moduleIdFormat)
}
def classifiersModuleTask: Initialize[Task[GetClassifiersModule]] =

View File

@ -56,7 +56,7 @@ object RemoteCache {
import LibraryManagementCodec.*
import sjsonnew.support.scalajson.unsafe.*
val format: JsonFormat[Artifact] = summon[JsonFormat[Artifact]]
CompactPrinter(Converter.toJsonUnsafe(art)(format))
CompactPrinter(Converter.toJsonUnsafe(art)(using format))
}
def gitCommitId: String =

View File

@ -242,9 +242,9 @@ private[sbt] object LibraryManagement {
import sjsonnew.support.scalajson.unsafe.*
val moduleIdFormat: JsonFormat[ModuleID] = implicitly[JsonFormat[ModuleID]]
def write(key: ModuleID): String =
CompactPrinter(Converter.toJsonUnsafe(key)(moduleIdFormat))
CompactPrinter(Converter.toJsonUnsafe(key)(using moduleIdFormat))
def read(key: String): ModuleID =
Converter.fromJsonUnsafe[ModuleID](Parser.parseUnsafe(key))(moduleIdFormat)
Converter.fromJsonUnsafe[ModuleID](Parser.parseUnsafe(key))(using moduleIdFormat)
}
/**

View File

@ -158,13 +158,13 @@ object FileStamp {
override def write[J](obj: Seq[(Path, FileStamp)], builder: Builder[J]): Unit = {
val (hashes, lastModifiedTimes) = obj.partition(_._2.isInstanceOf[Hash])
builder.beginObject()
builder.addField("hashes", hashes.asInstanceOf[Seq[(Path, Hash)]])(
builder.addField("hashes", hashes.asInstanceOf[Seq[(Path, Hash)]])(using
seqPathHashJsonFormatter
)
builder.addField(
"lastModifiedTimes",
lastModifiedTimes.asInstanceOf[Seq[(Path, LastModified)]]
)(seqPathLastModifiedJsonFormatter)
)(using seqPathLastModifiedJsonFormatter)
builder.endObject()
}