Skip to content

Commit d7041cd

Browse files
Add TraversableOnce.knownSize
1 parent 7ff8323 commit d7041cd

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

compat/src/main/scala-2.11_2.12/scala/collection/compat/PackageShared.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,7 @@ class IteratorExtensionMethods[A](private val self: c.Iterator[A]) extends AnyVa
221221

222222
class TraversableOnceExtensionMethods[A](private val self: c.TraversableOnce[A]) extends AnyVal {
223223
def iterator: Iterator[A] = self.toIterator
224+
def knownSize: Int = if (t.hasDefiniteSize) t.size else -1
224225
}
225226

226227
class TraversableExtensionMethods[A](private val self: c.Traversable[A]) extends AnyVal {

scalafix/rules/src/main/scala/fix/Roughly.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,14 +71,14 @@ final case class Roughly(index: SemanticdbIndex, config: RoughlyConfig)
7171
ctx.tree.collect {
7272
case ap @ Term.ApplyInfix(_, mapValues(_), _, _) if strictMapValues =>
7373
ctx.addLeft(ap, "(") +
74-
ctx.addRight(ap, ").toMap")
74+
ctx.addRight(ap, ").toMap")
7575

7676
case ap @ Term.Apply(Term.Select(_, mapValues(_)), List(_)) if strictMapValues =>
7777
ctx.addRight(ap, ".toMap")
7878

7979
case ap @ Term.ApplyInfix(_, filterKeys(_), _, _) if strictFilterKeys =>
8080
ctx.addLeft(ap, "(") +
81-
ctx.addRight(ap, ").toMap")
81+
ctx.addRight(ap, ").toMap")
8282

8383
case ap @ Term.Apply(Term.Select(_, filterKeys(_)), List(_)) if strictFilterKeys =>
8484
ctx.addRight(ap, ".toMap")

0 commit comments

Comments
 (0)