From dd9906fd2dc3cfe9b74fcf1d2d6deb73abe68434 Mon Sep 17 00:00:00 2001 From: Yann Simon Date: Thu, 19 Sep 2024 10:07:15 +0200 Subject: [PATCH] minor code cleanup --- src/main/scala/sangria/marshalling/ArrayMapBuilder.scala | 8 ++++---- src/main/scala/sangria/marshalling/FromInput.scala | 1 - src/main/scala/sangria/marshalling/MarshallingUtil.scala | 2 +- src/main/scala/sangria/marshalling/ToInput.scala | 1 - 4 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/main/scala/sangria/marshalling/ArrayMapBuilder.scala b/src/main/scala/sangria/marshalling/ArrayMapBuilder.scala index 5290b0e..f822715 100644 --- a/src/main/scala/sangria/marshalling/ArrayMapBuilder.scala +++ b/src/main/scala/sangria/marshalling/ArrayMapBuilder.scala @@ -12,7 +12,7 @@ class ArrayMapBuilder[T](keys: Seq[String]) extends Iterable[(String, T)] { private val indexLookup = keys.iterator.zipWithIndex.toMap private val indexesSet = MutableSet[Int]() - def add(key: String, elem: T) = { + def add(key: String, elem: T): ArrayMapBuilder[T] = { val idx = indexLookup(key) elements(idx) = key -> elem @@ -65,9 +65,9 @@ class ArrayMapBuilder[T](keys: Seq[String]) extends Iterable[(String, T)] { override def iterator: Iterator[(String, T)] = new Iterator[(String, T)] { - var index = -1 - var nextIndex = -1 - val elementsLength = elements.length + private var index = -1 + private var nextIndex = -1 + private val elementsLength = elements.length @tailrec def nextIndex(current: Int): Int = { val next = current + 1 diff --git a/src/main/scala/sangria/marshalling/FromInput.scala b/src/main/scala/sangria/marshalling/FromInput.scala index 7d91ad2..a5367f3 100644 --- a/src/main/scala/sangria/marshalling/FromInput.scala +++ b/src/main/scala/sangria/marshalling/FromInput.scala @@ -1,7 +1,6 @@ package sangria.marshalling import scala.annotation.implicitNotFound -import scala.language.higherKinds @implicitNotFound( "Type ${Val} cannot be used as an input. Please consider defining an implicit instance of `FromInput` for it.") diff --git a/src/main/scala/sangria/marshalling/MarshallingUtil.scala b/src/main/scala/sangria/marshalling/MarshallingUtil.scala index 0abf2fb..01a7700 100644 --- a/src/main/scala/sangria/marshalling/MarshallingUtil.scala +++ b/src/main/scala/sangria/marshalling/MarshallingUtil.scala @@ -35,7 +35,7 @@ object MarshallingUtil { } implicit class MarshaledConverter[In: InputUnmarshaller](in: In) { - def convertMarshaled[Out: ResultMarshallerForType] = convert(in) + def convertMarshaled[Out: ResultMarshallerForType]: Out = convert(in) } implicit class ResultMarshallerOps(val m: ResultMarshaller) extends AnyVal { diff --git a/src/main/scala/sangria/marshalling/ToInput.scala b/src/main/scala/sangria/marshalling/ToInput.scala index 669aea2..23c10ee 100644 --- a/src/main/scala/sangria/marshalling/ToInput.scala +++ b/src/main/scala/sangria/marshalling/ToInput.scala @@ -3,7 +3,6 @@ package sangria.marshalling import sangria.util.tag._ import scala.annotation.implicitNotFound -import scala.language.higherKinds @implicitNotFound( "Type ${Val} cannot be used as a default value. Please consider defining an implicit instance of `ToInput` for it.")