The Inline Variable refactoring replaces redundant variable usage with its last assigned value.

To invoke the refactoring, move the caret at the required local variable and press &shortcut:Inline; (Refactor | Inline ).

inline variable

You can also inline functions, parameters, constants, macros, and typedefs.