Inline Return

Convert a variable assignment to a return statement.

refactoring (inline)
safe

Inline return converts a variable assignment to a return statement. Such a conversion is possible when the following statement after the assignment in the control flow returns the variable.

This refactoring simplifies the control flow and makes it easier to reason about a function.

Related Code Actions