Skip to content

Commit

Permalink
Drop varargs with Utility.combineAdjacentTextNodes
Browse files Browse the repository at this point in the history
  • Loading branch information
ashawley committed Jun 26, 2018
1 parent acab668 commit 1a3b751
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions shared/src/main/scala/scala/xml/Utility.scala
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@ object Utility extends AnyRef with parsing.TokenTests {
*/
def trim(x: Node): Node = x match {
case Elem(pre, lab, md, scp, child@_*) =>
val children = combineAdjacentTextNodes(child:_*) flatMap trimProper
val children = combineAdjacentTextNodes(child) flatMap trimProper
Elem(pre, lab, md, scp, children.isEmpty, children: _*)
}

private def combineAdjacentTextNodes(children: Node*): Seq[Node] = {
private def combineAdjacentTextNodes(children: Seq[Node]): Seq[Node] = {
children.foldRight(Seq.empty[Node]) {
case (Text(left), Text(right) +: nodes) => Text(left + right) +: nodes
case (n, nodes) => n +: nodes
Expand All @@ -63,7 +63,7 @@ object Utility extends AnyRef with parsing.TokenTests {
*/
def trimProper(x: Node): Seq[Node] = x match {
case Elem(pre, lab, md, scp, child@_*) =>
val children = combineAdjacentTextNodes(child:_*) flatMap trimProper
val children = combineAdjacentTextNodes(child) flatMap trimProper
Elem(pre, lab, md, scp, children.isEmpty, children: _*)
case Text(s) =>
new TextBuffer().append(s).toText
Expand Down

0 comments on commit 1a3b751

Please sign in to comment.