2 ms·
Specifically, note that mistaken use of `=` vs. `==` is impossible in Rust regardless of this proposal, since: 1. assignment is an expression that returns nil
by kibwen 13y ago
Specifically, note that mistaken use of `=` vs. `==` is impossible in Rust regardless of this proposal, since:
1. assignment is an expression that returns nil
2. `if` expressions require their conditions to evaluate to boolean
3. no types can be implicitly coerced to boolean
An example:
fn main() {
let mut x = 2;
if x = 4 {} // error: mismatched types: expected `bool` but found `()`
}