remove unnecessary variables
Merge branch 'cs/#6921-remove-unused-variable-assignments'

Close #6921
Revert "Update from original"