Apply suggestions from code review
Apply suggestions from code review

Co-authored-by: Tadej Ciglarič <b3b2456e5653b9f22852116a995de6ae2fa6610b@gmail.com>
stan-dev/math,stan-dev/math,stan-dev/math,stan-dev/math,stan-dev/math,stan-dev/math,stan-dev/math,stan-dev/math,stan-dev/math