Example:
let x = if test { // Option<i32>
1
}
let y = if test { // Option<i32>
1
} else if test2 {
2
}
let z = if test { // i32
1
} else {
2
}
The confusion caused by this, and harm to readability, far outweigh the 20 characters it saves : Some(..) else { None }
The problem is that let x = if test { 1 } is never compiled
There's a boolinator crate for situations like this one. Why not use it?
extern crate boolinator;
use boolinator::Boolinator;
let x = test.as_some_from(|| 1);
let y = test.as_some_from(|| 1).or_else(|| test2.as_some_from(|| 2));
Related discussion: https://github.com/rust-lang/rfcs/pull/2180#issuecomment-337774914
This seems like a breaking change I don't think there is sufficient motivation to make with the edition mechanism so I'll close as non-actionable.
Most helpful comment
The confusion caused by this, and harm to readability, far outweigh the 20 characters it saves :
Some(..)else { None }