Why this matters
Methods returning values that are never used introduce unnecessary complexity. Remove such return values to improve clarity.
Methods returning values that are never used introduce unnecessary complexity. Remove such return values to improve clarity.
Methods returning values that are never used introduce unnecessary complexity. Remove such return values to improve clarity.
Side-by-side examples engineers can pattern-match during review.
class SomeClass
{
private int PrivateMethod() => 42;
public void PublicMethod()
{
PrivateMethod(); // Noncompliant: the result of PrivateMethod is not used
}
}// (no example provided)class SomeClass
{
private int PrivateMethod() => 42;
public void PublicMethod()
{
PrivateMethod(); // Noncompliant: the result of PrivateMethod is not used
}
}From the same buckets as this rule.