cleanup #list_of

* remove unnecessary local variable `to_return`
* assign if statement to result
* fix whitespace