Fix compile warnings after scala update

This commit is contained in:
eikek
2024-03-03 18:43:54 +01:00
parent 3e76385d08
commit 924aaf720e
79 changed files with 383 additions and 256 deletions

View File

@ -78,7 +78,11 @@ case class LenientUri(
.covary[F]
.rethrow
.flatMap(url =>
fs2.io.readInputStream(Sync[F].delay(url.openStream()), chunkSize, true)
fs2.io.readInputStream(
Sync[F].delay(url.openStream()),
chunkSize,
closeAfterUse = true
)
)
def readText[F[_]: Sync](chunkSize: Int): F[String] =
@ -121,7 +125,7 @@ object LenientUri {
val isRoot = true
val isEmpty = false
def /(seg: String): Path =
NonEmptyPath(NonEmptyList.of(seg), false)
NonEmptyPath(NonEmptyList.of(seg), trailingSlash = false)
def asString = "/"
}
case object EmptyPath extends Path {
@ -129,7 +133,7 @@ object LenientUri {
val isRoot = false
val isEmpty = true
def /(seg: String): Path =
NonEmptyPath(NonEmptyList.of(seg), false)
NonEmptyPath(NonEmptyList.of(seg), trailingSlash = false)
def asString = ""
}
case class NonEmptyPath(segs: NonEmptyList[String], trailingSlash: Boolean)

View File

@ -194,7 +194,7 @@ object MimeType {
val csValueStart = in.substring(n + "charset=".length).trim
val csName = csValueStart.indexOf(';') match {
case -1 => unquote(csValueStart).trim
case n => unquote(csValueStart.substring(0, n)).trim
case n2 => unquote(csValueStart.substring(0, n2)).trim
}
if (Charset.isSupported(csName)) Right((Some(Charset.forName(csName)), ""))
else Right((None, ""))

View File

@ -62,7 +62,7 @@ object UrlMatcher {
// strip path to only match prefixes
val mPath: LenientUri.Path =
NonEmptyList.fromList(url.path.segments.take(pathSegmentCount)) match {
case Some(nel) => LenientUri.NonEmptyPath(nel, false)
case Some(nel) => LenientUri.NonEmptyPath(nel, trailingSlash = false)
case None => LenientUri.RootPath
}