Fix minor syntax problems

Fix trailing whitespace and adapt function to fit Rust style
guidelines.