Sometimes, the trick that variable's names have of matching any value in a pattern would be useful, but we don't actually need the information that would be stored in the variable. For example, we might not care about the error value when matching Result, just the fact that there was an error. In that situation, we can use an _ symbol to indicate I don't care what this value is:
match might_fail(39) {
Ok(x) => { println!("Odd succeeded, name is {}", x.name) }
Err(_) => { println!("Odd failed! Woe is me.") }
}
That's the reason why _ by itself can not be used as a variable name: it has a special meaning of its own. We can match _ against any data value of any data type, even multiple times in the same expression, and the matched values will simply be ignored.
Matching a value to _ does not even...