Remove unnecessary expression statement

Remove an expression statement that has no side-effects.

Cleanup
P42 for VS Code
P42 for GitHub
Remove unnecessary expression statement

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 // p42:ignore-next-statement.

Configuration

Learn More

Available In