Autoformat

This commit is contained in:
Eike Kettner
2020-09-09 00:29:32 +02:00
parent 570b7de43f
commit c658677032
34 changed files with 279 additions and 319 deletions

View File

@ -222,12 +222,11 @@ object LenientUri {
def percentDecode(s: String): String =
if (!s.contains("%")) s
else
s.foldLeft(("", ByteVector.empty)) {
case ((acc, res), c) =>
if (acc.length == 2) ("", res ++ ByteVector.fromValidHex(acc.drop(1) + c))
else if (acc.startsWith("%")) (acc :+ c, res)
else if (c == '%') ("%", res)
else (acc, res :+ c.toByte)
s.foldLeft(("", ByteVector.empty)) { case ((acc, res), c) =>
if (acc.length == 2) ("", res ++ ByteVector.fromValidHex(acc.drop(1) + c))
else if (acc.startsWith("%")) (acc :+ c, res)
else if (c == '%') ("%", res)
else (acc, res :+ c.toByte)
}._2
.decodeUtf8
.fold(throw _, identity)

View File

@ -20,9 +20,8 @@ object SystemCommand {
def replace(repl: Map[String, String]): Config =
mapArgs(s =>
repl.foldLeft(s) {
case (res, (k, v)) =>
res.replace(k, v)
repl.foldLeft(s) { case (res, (k, v)) =>
res.replace(k, v)
}
)