let a = 1;
match a {
1 => {}
1 => {}
_ => {}
_ => {}
}
?
while this is obviously nonsense,
but things like these are possible:
let a = 1;
let x = 2;
match a {
x => {}
_ => {}
}
In fact we have here two _ branches, but for language newcomer,
this is not obvious, so any reasons to not emit compile time error, for such constructions?
For example for code in this question: rust - Why does match not work while PartialEq/Eq works fine? - Stack Overflow,
at first I got two warnings, one for unused vairable (match variable from => println!("1"),),
which was not understandable for me, and then warning about unreachable pattern,
which also not clear. Only after I understand that x => code, is actually _ => code, not if var == x I undertand compiler warnings.