Hi! I’ve noticed that rustc treats block-like expressions differently for determining if the ; or , is needed:
fn stmt() {
# no need for semicolons
{ () }
if true { () } else { () }
loop {}
while true {}
}
fn match_arm(n: i32) {
match n {
1 => { () } # can omit comma here
2 => if true { () } else { () }, # but all other cases do need semicolons.
3 => loop { },
4 => while true {},
_ => ()
}
}
This seems just weird to me… Is there a reason you really need , after an if in match? Perhaps this is a bug that needs to be fixed?