Skip to content

Commit

Permalink
update InterpolationToStringWarn
Browse files Browse the repository at this point in the history
  • Loading branch information
xuwei-k committed Aug 12, 2024
1 parent bd6f057 commit 7f8cc4a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ object InterpolationToStringWarnTest {
def x1(i: Int, a: A) = {
s" ${i.toString} b ${i.toString} c" // assert: InterpolationToStringWarn
s" ${2.toString} b " // assert: InterpolationToStringWarn
s" ${i.toString()} b " // assert: InterpolationToStringWarn
f" ${i.toString} b "
s" ${a.toString(i)} b c "
}
Expand Down
5 changes: 5 additions & 0 deletions rules/src/main/scala/fix/InterpolationToStringWarn.scala
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ private object InterpolationToStringWarn {
x @ Term.Name("toString")
) =>
x
case Term.Apply.After_4_6_0(
Term.Select(_, x @ Term.Name("toString")),
Term.ArgClause(Nil, None)
) =>
x
}
}
}

0 comments on commit 7f8cc4a

Please sign in to comment.