File tree 1 file changed +11
-6
lines changed
scalafix/rules/src/main/scala/fix 1 file changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -45,8 +45,6 @@ trait Stable212Base extends CrossCompatibility { self: SemanticRule =>
45
45
val traversable = exact(
46
46
" _root_.scala.package.Traversable#" ,
47
47
" _root_.scala.collection.Traversable#" ,
48
- " _root_.scala.package.Iterable#" ,
49
- " _root_.scala.collection.Iterable#"
50
48
)
51
49
52
50
object Breakout {
@@ -236,10 +234,17 @@ trait Stable212Base extends CrossCompatibility { self: SemanticRule =>
236
234
}
237
235
238
236
def replaceIterableSameElements (ctx : RuleCtx ): Patch = {
239
- ctx.tree.collect {
240
- case Term .Apply (Term .Select (lhs, iterableSameElement(_)), List (_)) =>
241
- ctx.addRight(lhs, " .iterator" )
242
- }.asPatch
237
+ val sameElements =
238
+ ctx.tree.collect {
239
+ case Term .Apply (Term .Select (lhs, iterableSameElement(_)), List (_)) =>
240
+ ctx.addRight(lhs, " .iterator" )
241
+ }.asPatch
242
+
243
+ val compatImport =
244
+ if (sameElements.nonEmpty) addCompatImport(ctx)
245
+ else Patch .empty
246
+
247
+ sameElements + compatImport
243
248
}
244
249
245
250
You can’t perform that action at this time.
0 commit comments