Merge pull request #23472 from dmatej/trim-all-trailing-whitespaces-and-make-it-better

Trim all trailing whitespaces and easy formatting when necessary