Fix unmatched returns dialyzer warnings

Fixes unmatched returns dialyzer warnings from #2478.

Generated erlang issues:
* There are still warnings for `for` comprehensions when matched against an empty variable.
* Unmatched returns for `cond` expressions report the wrong line (the line of the first clause).
I wonder if we removed all else branches and then added `|| false` at the end would be enough to make dialyzer happy?