I use both of these idioms – and others – quite often. My main heuristic is: “is the code readable?”
The only non-idiomatic Elixir in such cases would be a load of if-s. The rest is quite fine and the exact idiom should vary depending on your priorities and the situation.
The first one, as it leaves more room for optimisation by the compiler. Also matching 0 in the function head is more strict than x == 0 since 0.0 == 0.
PS: sometimes, if from business perspective both cases are to treat the same and not only by accident, I tend to use a guard using ===, as it better communicates indent of treating this cases the same.