Kotlin
Redundant call to 'toString()' in string template
Info
New
Last modified: 03 December 2024 Reports calls to toString()
in string templates that can be safely removed.
Example:
fun foo(a: Int, b: Int) = a + b
fun test(): String {
return "Foo: ${foo(0, 4).toString()}" // 'toString()' is redundant
}
After the quick-fix is applied:
fun foo(a: Int, b: Int) = a + b
fun test(): String {
return "Foo: ${foo(0, 4)}"
}
- By ID
Can be used to locate inspection in e.g. Qodana configuration files, where you can quickly enable or disable it, or adjust its settings.
RemoveToStringInStringTemplate
Inspection Details | |
---|---|
By default bundled with: | |
Can be installed with plugin: | Kotlin, 243.23126-IJ |
Thanks for your feedback!
Was this page helpful?