Why is this `if` here instead of as guard of the pattern?