Remove some dead code and fix some pyflakes warnings in CodegenRust.py.
Merge pull request #2807 from Ms2ger/pyflakes-2

Remove some dead code and fix some pyflakes warnings in CodegenRust.py.