Not only can you change the Visual Studio Code settings to trim trailing whitespace automatically, but you can also do this from the command palette (Ctrl+Shift+P):

You can also use the keyboard shortcut:
- Windows, Linux: Ctrl+K, Ctrl+X
- Mac: ? + k, ? + x.
(I'm using Visual Studio Code 1.20.1.)