Remove unnecessary expression statement
Remove an expression statement that has no side-effects.
Why is this refactoring useful?
An expression statement without side effects does not affect the behavior of the program. Removing it reduces the amount of code that needs to be understood and removes unnecessary computation.
What do I need to consider?
In benchmarks, it is common to run expression statements without side effects in a loop. In tests for language tooling, it is common to have scenarios with side-effect-free expression statements. In those situations, you can disable the suggestions for the statement using
- Code Assist ID (for the configuration file):
- You can configure custom keyboard shortcuts with these code action kinds:
- This code assist provides refactoring suggestions. Learn how to configure the refactoring suggestion visibility.