Unused variables are allowed in Solidity and they do not pose a direct security issue. It is best practice though to avoid them as they can:
- Cause an increase in computations (and unnecessary gas consumption)
- Indicate bugs or malformed data structures and they are generally a sign of poor code quality
- Cause code noise and decrease readability of the code
Remove all unused variables from the code base.