rspec/rules/S1858/rule.adoc
Fred Tingaud 16f6c0aecf
Inline adoc when include has no additional value (#1940)
Inline adoc files when they are included exactly once.

Also fix language tags because this inlining gives us better information
on what language the code is written in.
2023-05-25 14:18:12 +02:00

23 lines
511 B
Plaintext

== Why is this an issue?
Invoking a method designed to return a string representation of an object which is already a string is a waste of keystrokes. This redundant construction may be optimized by the compiler, but will be confusing in the meantime.
=== Noncompliant code example
[source,text]
----
String message = "hello world";
System.out.println(message.toString()); // Noncompliant;
----
=== Compliant solution
[source,text]
----
String message = "hello world";
System.out.println(message);
----