Remove unnecessary local variables. #1555
Fixes `UnnecessaryLocalVariable` inspection violations. Description: >Reports unnecessary local variables, which add nothing to the comprehensibility of a method. Variables caught include local variables which are immediately returned, local variables that are immediately assigned to another variable and then not used, and local variables which always have the same value as another local variable or parameter.
This commit is contained in:
parent
27375d0815
commit
d5129db907
|
|
@ -48,9 +48,7 @@ public abstract class BaseCheckTestSupport
|
|||
|
||||
public static DefaultConfiguration createCheckConfig(Class<?> aClazz)
|
||||
{
|
||||
final DefaultConfiguration checkConfig =
|
||||
new DefaultConfiguration(aClazz.getName());
|
||||
return checkConfig;
|
||||
return new DefaultConfiguration(aClazz.getName());
|
||||
}
|
||||
|
||||
protected Checker createChecker(Configuration aCheckConfig)
|
||||
|
|
|
|||
|
|
@ -226,8 +226,7 @@ public class InnerAssignmentCheck
|
|||
DetailAST current = ast;
|
||||
for (int anElement : element) {
|
||||
current = current.getParent();
|
||||
final int expectedType = anElement;
|
||||
if (current.getType() == expectedType) {
|
||||
if (current.getType() == anElement) {
|
||||
found = true;
|
||||
}
|
||||
else {
|
||||
|
|
|
|||
Loading…
Reference in New Issue