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