From 7f8cc4a81d98753a08165b39c53fc9dd1bda97cb Mon Sep 17 00:00:00 2001 From: xuwei-k <6b656e6a69@gmail.com> Date: Mon, 12 Aug 2024 18:46:48 +0900 Subject: [PATCH] update InterpolationToStringWarn --- input/src/main/scala/fix/InterpolationToStringWarnTest.scala | 1 + rules/src/main/scala/fix/InterpolationToStringWarn.scala | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/input/src/main/scala/fix/InterpolationToStringWarnTest.scala b/input/src/main/scala/fix/InterpolationToStringWarnTest.scala index e42052c..5e823a8 100644 --- a/input/src/main/scala/fix/InterpolationToStringWarnTest.scala +++ b/input/src/main/scala/fix/InterpolationToStringWarnTest.scala @@ -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 " } diff --git a/rules/src/main/scala/fix/InterpolationToStringWarn.scala b/rules/src/main/scala/fix/InterpolationToStringWarn.scala index e7e9a76..becbfd4 100644 --- a/rules/src/main/scala/fix/InterpolationToStringWarn.scala +++ b/rules/src/main/scala/fix/InterpolationToStringWarn.scala @@ -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 } } }