A variable is considered unused in the following cases:
- The value of the variable is not used anywhere or is overwritten immediately.
- The reference stored in the variable is not used anywhere or is overwritten immediately.
The inspection is disabled for global space by default.
To change the behaviour check the option "Enable inspection in global space".