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:
Michal Kordas 2015-08-21 23:52:39 +02:00 committed by Roman Ivanov
parent 27375d0815
commit d5129db907
2 changed files with 2 additions and 5 deletions

View File

@ -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)

View File

@ -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 {