Remove some unused imports/variables.

A batch of unused imports are removed. Unused variables are either removed, or commented out
if they are referenced in pre-existing comments. Files not modified include tests or ast files.