Module blog::daily_rfcs::matching::_0160_if_let
source · [−]Expand description
Introduce if let PAT = EXPR { BODY }
construct.
if let Some(x) = opt_val {
do(x);
} else if cond() {
do();
} else {
do();
}
desugar:
match opt_val {
Some(x) => {
do(x);
}
_ if cond() => {}
_ => {}
}
Note
else if
=>_ if guard => {}
else
=>_ => {}