Somehow variable names in match statements just don't work. (those match statements that have an or condition)
let i = 2;
// this works perfectly fine
match i {
0 | 5 => println!("First or last index"),
_ => println!("Somewhere in the middle")
};
// but this doesn't?
let first = 0;
let last = 5;
match i {
last | first => println!("First or last index"),
_ => println!("Somewhere in the middle")
};
I think the code explains my confusion well enough. I can't tell why having variable names suddenly makes rust complain. If you also wanna know the full error complaints check the image.