Guards example may be confusing (original) (raw)
In https://doc.rust-lang.org/rust-by-example/flow_control/match/guard.html, it is stated that:
Note that the compiler does not check arbitrary expressions for whether all possible conditions have been checked. Therefore, you must use the _ pattern at the end.
I was teaching a class today where someone interpreted this sentence as _
being mandatory when using guard expressions. They were weirded out because of an example where I bound to a variable instead (bc. the guards weren't covering) and didn't know that was possible.