Removes all trailing whitespace.

Discussion in #569 mentioned that a PR trimming all the trailing whitespace would be welcome.

Tip: when in the github diff view, append the query parameter `w=1` to see the diff ignoring whitespace.