2022-11-21 13:34:47 -06:00
|
|
|
error: this could be rewritten as `let...else`
|
2023-05-20 08:39:26 -05:00
|
|
|
--> $DIR/manual_let_else.rs:24:5
|
2022-11-21 13:34:47 -06:00
|
|
|
|
|
|
|
|
LL | let v = if let Some(v_some) = g() { v_some } else { return };
|
2023-05-20 08:39:26 -05:00
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider writing: `let Some(v) = g() else { return };`
|
2022-11-21 13:34:47 -06:00
|
|
|
|
|
|
|
|
= note: `-D clippy::manual-let-else` implied by `-D warnings`
|
|
|
|
|
|
|
|
error: this could be rewritten as `let...else`
|
2023-05-20 08:39:26 -05:00
|
|
|
--> $DIR/manual_let_else.rs:25:5
|
2022-11-21 13:34:47 -06:00
|
|
|
|
|
|
|
|
LL | / let v = if let Some(v_some) = g() {
|
|
|
|
LL | | v_some
|
|
|
|
LL | | } else {
|
|
|
|
LL | | return;
|
|
|
|
LL | | };
|
|
|
|
| |______^
|
|
|
|
|
|
|
|
|
help: consider writing
|
|
|
|
|
|
2023-05-20 08:39:26 -05:00
|
|
|
LL ~ let Some(v) = g() else {
|
2022-11-21 13:34:47 -06:00
|
|
|
LL + return;
|
|
|
|
LL + };
|
|
|
|
|
|
|
|
|
|
|
|
|
error: this could be rewritten as `let...else`
|
2023-05-20 08:39:26 -05:00
|
|
|
--> $DIR/manual_let_else.rs:31:5
|
2022-11-21 13:34:47 -06:00
|
|
|
|
|
|
|
|
LL | / let v = if let Some(v) = g() {
|
|
|
|
LL | | // Blocks around the identity should have no impact
|
|
|
|
LL | | {
|
|
|
|
LL | | { v }
|
|
|
|
... |
|
|
|
|
LL | | return;
|
|
|
|
LL | | };
|
|
|
|
| |______^
|
|
|
|
|
|
|
|
|
help: consider writing
|
|
|
|
|
|
|
|
|
LL ~ let Some(v) = g() else {
|
|
|
|
LL + // Some computation should still make it fire
|
|
|
|
LL + g();
|
|
|
|
LL + return;
|
|
|
|
LL + };
|
|
|
|
|
|
|
|
|
|
|
|
|
error: this could be rewritten as `let...else`
|
2023-05-20 08:39:26 -05:00
|
|
|
--> $DIR/manual_let_else.rs:44:9
|
2022-11-21 13:34:47 -06:00
|
|
|
|
|
|
|
|
LL | let v = if let Some(v_some) = g() { v_some } else { continue };
|
2023-05-20 08:39:26 -05:00
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider writing: `let Some(v) = g() else { continue };`
|
2022-11-21 13:34:47 -06:00
|
|
|
|
|
|
|
error: this could be rewritten as `let...else`
|
2023-05-20 08:39:26 -05:00
|
|
|
--> $DIR/manual_let_else.rs:45:9
|
2022-11-21 13:34:47 -06:00
|
|
|
|
|
|
|
|
LL | let v = if let Some(v_some) = g() { v_some } else { break };
|
2023-05-20 08:39:26 -05:00
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider writing: `let Some(v) = g() else { break };`
|
2022-11-21 13:34:47 -06:00
|
|
|
|
|
|
|
error: this could be rewritten as `let...else`
|
2023-05-20 08:39:26 -05:00
|
|
|
--> $DIR/manual_let_else.rs:49:5
|
2022-11-21 13:34:47 -06:00
|
|
|
|
|
|
|
|
LL | let v = if let Some(v_some) = g() { v_some } else { panic!() };
|
2023-05-20 08:39:26 -05:00
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider writing: `let Some(v) = g() else { panic!() };`
|
2022-11-21 13:34:47 -06:00
|
|
|
|
|
|
|
error: this could be rewritten as `let...else`
|
2023-05-20 08:39:26 -05:00
|
|
|
--> $DIR/manual_let_else.rs:52:5
|
2022-11-21 13:34:47 -06:00
|
|
|
|
|
|
|
|
LL | / let v = if let Some(v_some) = g() {
|
|
|
|
LL | | v_some
|
|
|
|
LL | | } else {
|
|
|
|
LL | | std::process::abort()
|
|
|
|
LL | | };
|
|
|
|
| |______^
|
|
|
|
|
|
|
|
|
help: consider writing
|
|
|
|
|
|
2023-05-20 08:39:26 -05:00
|
|
|
LL ~ let Some(v) = g() else {
|
2022-11-21 13:34:47 -06:00
|
|
|
LL + std::process::abort()
|
|
|
|
LL + };
|
|
|
|
|
|
|
|
|
|
|
|
|
error: this could be rewritten as `let...else`
|
2023-05-20 08:39:26 -05:00
|
|
|
--> $DIR/manual_let_else.rs:59:5
|
2022-11-21 13:34:47 -06:00
|
|
|
|
|
|
|
|
LL | / let v = if let Some(v_some) = g() {
|
|
|
|
LL | | v_some
|
|
|
|
LL | | } else {
|
|
|
|
LL | | if true { return } else { panic!() }
|
|
|
|
LL | | };
|
|
|
|
| |______^
|
|
|
|
|
|
|
|
|
help: consider writing
|
|
|
|
|
|
2023-05-20 08:39:26 -05:00
|
|
|
LL ~ let Some(v) = g() else {
|
2022-11-21 13:34:47 -06:00
|
|
|
LL + if true { return } else { panic!() }
|
|
|
|
LL + };
|
|
|
|
|
|
|
|
|
|
|
|
|
error: this could be rewritten as `let...else`
|
2023-05-20 08:39:26 -05:00
|
|
|
--> $DIR/manual_let_else.rs:66:5
|
2022-11-21 13:34:47 -06:00
|
|
|
|
|
|
|
|
LL | / let v = if let Some(v_some) = g() {
|
|
|
|
LL | | v_some
|
|
|
|
LL | | } else {
|
|
|
|
LL | | if true {}
|
|
|
|
LL | | panic!();
|
|
|
|
LL | | };
|
|
|
|
| |______^
|
|
|
|
|
|
|
|
|
help: consider writing
|
|
|
|
|
|
2023-05-20 08:39:26 -05:00
|
|
|
LL ~ let Some(v) = g() else {
|
2022-11-21 13:34:47 -06:00
|
|
|
LL + if true {}
|
|
|
|
LL + panic!();
|
|
|
|
LL + };
|
|
|
|
|
|
|
|
|
|
|
|
|
error: this could be rewritten as `let...else`
|
2023-05-20 08:39:26 -05:00
|
|
|
--> $DIR/manual_let_else.rs:76:5
|
2022-11-21 13:34:47 -06:00
|
|
|
|
|
|
|
|
LL | / let v = if let Some(v_some) = g() {
|
|
|
|
LL | | v_some
|
|
|
|
LL | | } else {
|
|
|
|
LL | | match () {
|
|
|
|
... |
|
|
|
|
LL | | }
|
|
|
|
LL | | };
|
|
|
|
| |______^
|
|
|
|
|
|
|
|
|
help: consider writing
|
|
|
|
|
|
2023-05-20 08:39:26 -05:00
|
|
|
LL ~ let Some(v) = g() else {
|
2022-11-21 13:34:47 -06:00
|
|
|
LL + match () {
|
|
|
|
LL + _ if panic!() => {},
|
|
|
|
LL + _ => panic!(),
|
|
|
|
LL + }
|
|
|
|
LL + };
|
|
|
|
|
|
|
|
|
|
|
|
|
error: this could be rewritten as `let...else`
|
2023-05-20 08:39:26 -05:00
|
|
|
--> $DIR/manual_let_else.rs:86:5
|
2022-11-21 13:34:47 -06:00
|
|
|
|
|
|
|
|
LL | let v = if let Some(v_some) = g() { v_some } else { if panic!() {} };
|
2023-05-20 08:39:26 -05:00
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider writing: `let Some(v) = g() else { if panic!() {} };`
|
2022-11-21 13:34:47 -06:00
|
|
|
|
|
|
|
error: this could be rewritten as `let...else`
|
2023-05-20 08:39:26 -05:00
|
|
|
--> $DIR/manual_let_else.rs:89:5
|
2022-11-21 13:34:47 -06:00
|
|
|
|
|
|
|
|
LL | / let v = if let Some(v_some) = g() {
|
|
|
|
LL | | v_some
|
|
|
|
LL | | } else {
|
|
|
|
LL | | match panic!() {
|
|
|
|
LL | | _ => {},
|
|
|
|
LL | | }
|
|
|
|
LL | | };
|
|
|
|
| |______^
|
|
|
|
|
|
|
|
|
help: consider writing
|
|
|
|
|
|
2023-05-20 08:39:26 -05:00
|
|
|
LL ~ let Some(v) = g() else {
|
2022-11-21 13:34:47 -06:00
|
|
|
LL + match panic!() {
|
|
|
|
LL + _ => {},
|
|
|
|
LL + }
|
|
|
|
LL + };
|
|
|
|
|
|
|
|
|
|
|
|
|
error: this could be rewritten as `let...else`
|
2023-05-20 08:39:26 -05:00
|
|
|
--> $DIR/manual_let_else.rs:98:5
|
2022-11-21 13:34:47 -06:00
|
|
|
|
|
|
|
|
LL | / let v = if let Some(v_some) = g() {
|
|
|
|
LL | | v_some
|
|
|
|
LL | | } else if true {
|
|
|
|
LL | | return;
|
|
|
|
LL | | } else {
|
|
|
|
LL | | panic!("diverge");
|
|
|
|
LL | | };
|
|
|
|
| |______^
|
|
|
|
|
|
|
|
|
help: consider writing
|
|
|
|
|
|
2023-05-20 08:39:26 -05:00
|
|
|
LL ~ let Some(v) = g() else { if true {
|
2022-11-21 13:34:47 -06:00
|
|
|
LL + return;
|
|
|
|
LL + } else {
|
|
|
|
LL + panic!("diverge");
|
|
|
|
LL + } };
|
|
|
|
|
|
|
|
|
|
|
|
|
error: this could be rewritten as `let...else`
|
2023-05-20 08:39:26 -05:00
|
|
|
--> $DIR/manual_let_else.rs:107:5
|
2022-11-21 13:34:47 -06:00
|
|
|
|
|
|
|
|
LL | / let v = if let Some(v_some) = g() {
|
|
|
|
LL | | v_some
|
|
|
|
LL | | } else {
|
|
|
|
LL | | match (g(), g()) {
|
|
|
|
... |
|
|
|
|
LL | | }
|
|
|
|
LL | | };
|
|
|
|
| |______^
|
|
|
|
|
|
|
|
|
help: consider writing
|
|
|
|
|
|
2023-05-20 08:39:26 -05:00
|
|
|
LL ~ let Some(v) = g() else {
|
2022-11-21 13:34:47 -06:00
|
|
|
LL + match (g(), g()) {
|
|
|
|
LL + (Some(_), None) => return,
|
|
|
|
LL + (None, Some(_)) => {
|
|
|
|
LL + if true {
|
|
|
|
LL + return;
|
|
|
|
LL + } else {
|
|
|
|
LL + panic!();
|
|
|
|
LL + }
|
|
|
|
LL + },
|
|
|
|
LL + _ => return,
|
|
|
|
LL + }
|
|
|
|
LL + };
|
|
|
|
|
|
|
|
|
|
|
|
|
error: this could be rewritten as `let...else`
|
2023-05-20 08:39:26 -05:00
|
|
|
--> $DIR/manual_let_else.rs:124:5
|
2022-11-21 13:34:47 -06:00
|
|
|
|
|
|
|
|
LL | / let (v, w) = if let Some(v_some) = g().map(|v| (v, 42)) {
|
|
|
|
LL | | v_some
|
|
|
|
LL | | } else {
|
|
|
|
LL | | return;
|
|
|
|
LL | | };
|
|
|
|
| |______^
|
|
|
|
|
|
|
|
|
help: consider writing
|
|
|
|
|
|
2023-05-20 08:39:26 -05:00
|
|
|
LL ~ let Some((v, w)) = g().map(|v| (v, 42)) else {
|
2022-11-21 13:34:47 -06:00
|
|
|
LL + return;
|
|
|
|
LL + };
|
|
|
|
|
|
|
|
|
|
|
|
|
error: this could be rewritten as `let...else`
|
2023-05-20 08:39:26 -05:00
|
|
|
--> $DIR/manual_let_else.rs:131:5
|
2022-11-21 13:34:47 -06:00
|
|
|
|
|
|
|
|
LL | / let v = if let (Some(v_some), w_some) = (g(), 0) {
|
|
|
|
LL | | (w_some, v_some)
|
|
|
|
LL | | } else {
|
|
|
|
LL | | return;
|
|
|
|
LL | | };
|
|
|
|
| |______^
|
|
|
|
|
|
|
|
|
help: consider writing
|
|
|
|
|
|
|
|
|
LL ~ let (Some(v_some), w_some) = (g(), 0) else {
|
|
|
|
LL + return;
|
|
|
|
LL + };
|
|
|
|
|
|
|
|
|
|
|
|
|
error: this could be rewritten as `let...else`
|
2023-05-20 08:39:26 -05:00
|
|
|
--> $DIR/manual_let_else.rs:140:13
|
2022-11-21 13:34:47 -06:00
|
|
|
|
|
|
|
|
LL | let $n = if let Some(v) = $e { v } else { return };
|
2023-05-20 08:39:26 -05:00
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider writing: `let Some($n) = g() else { return };`
|
2022-11-21 13:34:47 -06:00
|
|
|
...
|
|
|
|
LL | create_binding_if_some!(w, g());
|
|
|
|
| ------------------------------- in this macro invocation
|
|
|
|
|
|
|
|
|
= note: this error originates in the macro `create_binding_if_some` (in Nightly builds, run with -Z macro-backtrace for more info)
|
|
|
|
|
2022-12-01 11:29:38 -06:00
|
|
|
error: this could be rewritten as `let...else`
|
2023-05-20 08:39:26 -05:00
|
|
|
--> $DIR/manual_let_else.rs:150:5
|
|
|
|
|
|
|
|
|
LL | let v = if let Variant::A(a, 0) = e() { a } else { return };
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider writing: `let Variant::A(a, 0) = e() else { return };`
|
|
|
|
|
|
|
|
error: this could be rewritten as `let...else`
|
|
|
|
--> $DIR/manual_let_else.rs:152:5
|
|
|
|
|
|
|
|
|
LL | let v = if let Variant::B(b) = e() { b } else { return };
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider writing: `let Variant::B(v) = e() else { return };`
|
|
|
|
|
|
|
|
error: this could be rewritten as `let...else`
|
|
|
|
--> $DIR/manual_let_else.rs:262:5
|
2022-12-01 11:29:38 -06:00
|
|
|
|
|
|
|
|
LL | / let _ = match ff {
|
|
|
|
LL | | Some(value) => value,
|
|
|
|
LL | | _ => macro_call!(),
|
|
|
|
LL | | };
|
2023-05-20 08:39:26 -05:00
|
|
|
| |______^ help: consider writing: `let Some(_) = ff else { macro_call!() };`
|
2022-12-01 11:29:38 -06:00
|
|
|
|
2023-05-20 08:39:26 -05:00
|
|
|
error: aborting due to 20 previous errors
|
2022-11-21 13:34:47 -06:00
|
|
|
|