You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While running clippy in pedantic mode, I got this "manual_let_else" diagnostic from clippy (see below).
The fix suggestion surprised me. I don't think it is valid syntax (though it does look very nice).
Reproducer
I tried this code:
let msg = matchSome("hi"){Some(m) => m,
_ => unreachable!("can't happen"),};
I expected to see this happen:
warning: this could be rewritten as `let...else`
--> src\main.rs:2:5
|
2 | / let msg = match Some("hi") {
3 | | Some(x) => x,
4 | | _ => unreachable!("can't happen"),
5 | | };
| |______^ help: consider writing: `let Some(msg) = Some("hi") else { unreachable!("can't happen") };`
Instead, this happened:
warning: this could be rewritten as `let...else`
--> src\main.rs:2:5
|
2 | / let msg = match Some("hi") {
3 | | Some(x) => x,
4 | | _ => unreachable!("can't happen"),
5 | | };
| |______^ help: consider writing: `let Some(msg) = Some("hi") else unreachable!("can't happen");`
Summary
While running clippy in pedantic mode, I got this "manual_let_else" diagnostic from clippy (see below).
The fix suggestion surprised me. I don't think it is valid syntax (though it does look very nice).
Reproducer
I tried this code:
I expected to see this happen:
Instead, this happened:
Version
Additional Labels
No response
The text was updated successfully, but these errors were encountered: