From 359f85462479d933b44f01dc14742203c6785d3e Mon Sep 17 00:00:00 2001 From: Albert Meltzer <7529386+kitbellew@users.noreply.github.com> Date: Wed, 9 Feb 2022 09:13:36 -0800 Subject: [PATCH] TokenTraverser: remove unnecessary iterator --- .../src/main/scala/org/scalafmt/util/TokenTraverser.scala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scalafmt-core/shared/src/main/scala/org/scalafmt/util/TokenTraverser.scala b/scalafmt-core/shared/src/main/scala/org/scalafmt/util/TokenTraverser.scala index e6f779fb3f..622e2794fc 100644 --- a/scalafmt-core/shared/src/main/scala/org/scalafmt/util/TokenTraverser.scala +++ b/scalafmt-core/shared/src/main/scala/org/scalafmt/util/TokenTraverser.scala @@ -27,8 +27,8 @@ class TokenTraverser(tokens: Tokens, filename: String) { realTokens.headOption.foreach { // shebang in .sc files case t: Token.Ident if t.value.startsWith("#!") => - realTokens.iterator.takeWhile(!_.is[Token.LF]).foreach { tok => - excluded += TokenOps.hash(tok) + realTokens.takeWhile(!_.is[Token.LF]).foreach { + excluded += TokenOps.hash(_) } case _ => }