AutoRefactor icon indicating copy to clipboard operation
AutoRefactor copied to clipboard

New refactoring - Unnecessary assignment before return

Open JnRouvignac opened this issue 12 years ago • 0 comments

Given

The following starting code:

if (b) {
    result = obj.someMethod();
} else {
    result = 42;
}
return result;

When

... automatic refactorings are applied ...

Then

... code is refactored to:

if (b) {
    return obj.someMethod();
}
return 42;

JnRouvignac avatar Dec 14 '13 16:12 JnRouvignac