@Keats a = b is an expression like any other. That’s why you can use it in situations like
match expr {
pat => a = b,
}
It’s just that, since it has type (), it’s not a very useful expression. Banning it in certain situations would complicate Rust’s syntax though, it could break macros for instance.
This makes me wonder whether a = b should be an expression at all. Maybe match arms like that should require a block to be written:
match expr {
pat => { a = b; },
}
Alternatively, make match the special case and have an extra syntax rule for => a = b (are there any other places where assignment-as-an-expression is useful?).
Edit: Also +1 to changing the struct expression syntax to MyStruct { x = y } in the new edition.