Inspectopedia
 
2024.3

Unused assignment

Warning
Performance
New
Last modified: 03 December 2024

Reports a variable whose value is never used after assignment.

Suggests removing the unused variable to shorten the code and to avoid redundant allocations.

The following cases are reported:

  • A variable is never read after assignment.

  • The value of a variable is always overwritten with another assignment before the variable is read next time.

  • The initializer of a variable is redundant (for one of the above-mentioned reasons).