Skip to content

Commit

Permalink
FormatTokensRewrite: import mutable namespace only
Browse files Browse the repository at this point in the history
  • Loading branch information
kitbellew committed Mar 13, 2023
1 parent abb7516 commit 3b97f36
Showing 1 changed file with 5 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
package org.scalafmt.rewrite

import scala.annotation.tailrec
import scala.collection.mutable.ArrayBuffer
import scala.collection.mutable.ListBuffer
import scala.collection.mutable
import scala.meta.Tree
import scala.meta.tokens.{Token => T}

Expand Down Expand Up @@ -119,9 +118,9 @@ class FormatTokensRewrite(
* - for standalone tokens, simply invoke the rule and record any rewrites
*/
private def getRewrittenTokens: Iterable[Replacement] = {
implicit val tokens = new ArrayBuffer[Replacement]()
val leftDelimIndex = new ListBuffer[(Int, Option[Rule])]()
val formatOffStack = new ListBuffer[Boolean]()
implicit val tokens = new mutable.ArrayBuffer[Replacement]()
val leftDelimIndex = new mutable.ListBuffer[(Int, Option[Rule])]()
val formatOffStack = new mutable.ListBuffer[Boolean]()
arr.foreach { implicit ft =>
ft.right match {
case _: T.LeftBrace | _: T.LeftParen | _: T.LeftBracket =>
Expand Down Expand Up @@ -171,7 +170,7 @@ class FormatTokensRewrite(

private def applyRules(implicit
ft: FormatToken,
tokens: ArrayBuffer[Replacement]
tokens: mutable.ArrayBuffer[Replacement]
): Option[Rule] = {
implicit val style = styleMap.at(ft.right)
@tailrec
Expand Down Expand Up @@ -240,9 +239,6 @@ object FormatTokensRewrite {
private[rewrite] def removeToken(implicit ft: FormatToken): Replacement =
Left(ft.meta.idx)

private[rewrite] def keepToken(implicit ft: FormatToken): Replacement =
Right(ft)

private[rewrite] def replaceToken(
text: String,
owner: Option[Tree] = None
Expand Down

0 comments on commit 3b97f36

Please sign in to comment.