rust/tests/ui/manual_let_else.stderr

365 lines
9.8 KiB
Plaintext
Raw Normal View History

error: this could be rewritten as `let...else`
2023-06-10 06:43:30 -05:00
--> $DIR/manual_let_else.rs:25:5
|
LL | let v = if let Some(v_some) = g() { v_some } else { return };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider writing: `let Some(v) = g() else { return };`
|
= note: `-D clippy::manual-let-else` implied by `-D warnings`
error: this could be rewritten as `let...else`
2023-06-10 06:43:30 -05:00
--> $DIR/manual_let_else.rs:26:5
|
LL | / let v = if let Some(v_some) = g() {
LL | | v_some
LL | | } else {
LL | | return;
LL | | };
| |______^
|
help: consider writing
|
LL ~ let Some(v) = g() else {
LL + return;
LL + };
|
error: this could be rewritten as `let...else`
2023-06-10 06:43:30 -05:00
--> $DIR/manual_let_else.rs:32:5
|
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-06-10 06:43:30 -05:00
--> $DIR/manual_let_else.rs:45:9
|
LL | let v = if let Some(v_some) = g() { v_some } else { continue };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider writing: `let Some(v) = g() else { continue };`
error: this could be rewritten as `let...else`
2023-06-10 06:43:30 -05:00
--> $DIR/manual_let_else.rs:46:9
|
LL | let v = if let Some(v_some) = g() { v_some } else { break };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider writing: `let Some(v) = g() else { break };`
error: this could be rewritten as `let...else`
2023-06-10 06:43:30 -05:00
--> $DIR/manual_let_else.rs:50:5
|
LL | let v = if let Some(v_some) = g() { v_some } else { panic!() };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider writing: `let Some(v) = g() else { panic!() };`
error: this could be rewritten as `let...else`
2023-06-10 06:43:30 -05:00
--> $DIR/manual_let_else.rs:53:5
|
LL | / let v = if let Some(v_some) = g() {
LL | | v_some
LL | | } else {
LL | | std::process::abort()
LL | | };
| |______^
|
help: consider writing
|
LL ~ let Some(v) = g() else {
LL + std::process::abort()
LL + };
|
error: this could be rewritten as `let...else`
2023-06-10 06:43:30 -05:00
--> $DIR/manual_let_else.rs:60:5
|
LL | / let v = if let Some(v_some) = g() {
LL | | v_some
LL | | } else {
LL | | if true { return } else { panic!() }
LL | | };
| |______^
|
help: consider writing
|
LL ~ let Some(v) = g() else {
LL + if true { return } else { panic!() }
LL + };
|
error: this could be rewritten as `let...else`
2023-06-10 06:43:30 -05:00
--> $DIR/manual_let_else.rs:67:5
|
LL | / let v = if let Some(v_some) = g() {
LL | | v_some
LL | | } else {
LL | | if true {}
LL | | panic!();
LL | | };
| |______^
|
help: consider writing
|
LL ~ let Some(v) = g() else {
LL + if true {}
LL + panic!();
LL + };
|
error: this could be rewritten as `let...else`
2023-06-10 06:43:30 -05:00
--> $DIR/manual_let_else.rs:77:5
|
LL | / let v = if let Some(v_some) = g() {
LL | | v_some
LL | | } else {
LL | | match () {
... |
LL | | }
LL | | };
| |______^
|
help: consider writing
|
LL ~ let Some(v) = g() else {
LL + match () {
LL + _ if panic!() => {},
LL + _ => panic!(),
LL + }
LL + };
|
error: this could be rewritten as `let...else`
2023-06-10 06:43:30 -05:00
--> $DIR/manual_let_else.rs:87:5
|
LL | let v = if let Some(v_some) = g() { v_some } else { if panic!() {} };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider writing: `let Some(v) = g() else { if panic!() {} };`
error: this could be rewritten as `let...else`
2023-06-10 06:43:30 -05:00
--> $DIR/manual_let_else.rs:90:5
|
LL | / let v = if let Some(v_some) = g() {
LL | | v_some
LL | | } else {
LL | | match panic!() {
LL | | _ => {},
LL | | }
LL | | };
| |______^
|
help: consider writing
|
LL ~ let Some(v) = g() else {
LL + match panic!() {
LL + _ => {},
LL + }
LL + };
|
error: this could be rewritten as `let...else`
2023-06-10 06:43:30 -05:00
--> $DIR/manual_let_else.rs:99:5
|
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
|
LL ~ let Some(v) = g() else { if true {
LL + return;
LL + } else {
LL + panic!("diverge");
LL + } };
|
error: this could be rewritten as `let...else`
2023-06-10 06:43:30 -05:00
--> $DIR/manual_let_else.rs:108:5
|
LL | / let v = if let Some(v_some) = g() {
LL | | v_some
LL | | } else {
LL | | match (g(), g()) {
... |
LL | | }
LL | | };
| |______^
|
help: consider writing
|
LL ~ let Some(v) = g() else {
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-06-10 06:43:30 -05:00
--> $DIR/manual_let_else.rs:125:5
|
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
|
LL ~ let Some((v, w)) = g().map(|v| (v, 42)) else {
LL + return;
LL + };
|
error: this could be rewritten as `let...else`
2023-06-10 06:43:30 -05:00
--> $DIR/manual_let_else.rs:132:5
2022-02-17 22:43:48 -06:00
|
LL | / let (w, S { v }) = if let (Some(v_some), w_some) = (g().map(|_| S { v: 0 }), 0) {
2022-02-17 22:43:48 -06:00
LL | | (w_some, v_some)
LL | | } else {
LL | | return;
LL | | };
| |______^
|
help: consider writing
|
LL ~ let (Some(S { v }), w) = (g().map(|_| S { v: 0 }), 0) else {
LL + return;
LL + };
|
2022-02-17 22:43:48 -06:00
error: this could be rewritten as `let...else`
2023-06-10 06:43:30 -05:00
--> $DIR/manual_let_else.rs:141:13
2022-02-15 19:10:42 -06:00
|
LL | let $n = if let Some(v) = $e { v } else { return };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider writing: `let Some($n) = g() else { return };`
2022-02-15 19:10:42 -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)
error: this could be rewritten as `let...else`
2023-06-10 06:43:30 -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(v, 0) = e() else { return };`
error: this could be rewritten as `let...else`
2023-06-10 06:43:30 -05:00
--> $DIR/manual_let_else.rs:153:5
|
LL | let mut v = if let Variant::B(b) = e() { b } else { return };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider writing: `let Variant::B(mut v) = e() else { return };`
error: this could be rewritten as `let...else`
2023-06-10 06:43:30 -05:00
--> $DIR/manual_let_else.rs:157:5
|
LL | / let v = if let Ok(Some(Variant::B(b))) | Err(Some(Variant::A(b, _))) = nested {
LL | | b
LL | | } else {
LL | | return;
LL | | };
| |______^
|
help: consider writing
|
LL ~ let (Ok(Some(Variant::B(v))) | Err(Some(Variant::A(v, _)))) = nested else {
LL + return;
LL + };
|
error: this could be rewritten as `let...else`
2023-06-10 06:43:30 -05:00
--> $DIR/manual_let_else.rs:163:5
|
LL | let v = if let Variant::A(.., a) = e() { a } else { return };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider writing: `let Variant::A(.., v) = e() else { return };`
error: this could be rewritten as `let...else`
2023-06-10 06:43:30 -05:00
--> $DIR/manual_let_else.rs:166:5
|
LL | let w = if let (Some(v), ()) = (g(), ()) { v } else { return };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider writing: `let (Some(w), ()) = (g(), ()) else { return };`
error: this could be rewritten as `let...else`
2023-06-10 06:43:30 -05:00
--> $DIR/manual_let_else.rs:169:5
2023-06-01 18:25:22 -05:00
|
LL | / let w = if let Some(S { v: x }) = Some(S { v: 0 }) {
LL | | x
LL | | } else {
LL | | return;
LL | | };
| |______^
|
help: consider writing
|
LL ~ let Some(S { v: w }) = Some(S { v: 0 }) else {
LL + return;
LL + };
|
error: this could be rewritten as `let...else`
2023-06-10 06:43:30 -05:00
--> $DIR/manual_let_else.rs:176:5
2023-06-01 18:25:22 -05:00
|
LL | / let v = if let Some(S { v: x }) = Some(S { v: 0 }) {
LL | | x
LL | | } else {
LL | | return;
LL | | };
| |______^
|
help: consider writing
|
LL ~ let Some(S { v }) = Some(S { v: 0 }) else {
LL + return;
LL + };
|
error: this could be rewritten as `let...else`
2023-06-10 06:43:30 -05:00
--> $DIR/manual_let_else.rs:183:5
2023-06-01 18:25:22 -05:00
|
LL | / let (x, S { v }, w) = if let Some(U { v, w, x }) = None::<U<S<()>>> {
LL | | (x, v, w)
LL | | } else {
LL | | return;
LL | | };
| |______^
|
help: consider writing
|
LL ~ let Some(U { v: S { v }, w, x }) = None::<U<S<()>>> else {
LL + return;
LL + };
|
error: this could be rewritten as `let...else`
2023-06-10 06:43:30 -05:00
--> $DIR/manual_let_else.rs:297:5
|
LL | / let _ = match ff {
LL | | Some(value) => value,
LL | | _ => macro_call!(),
LL | | };
| |______^ help: consider writing: `let Some(_) = ff else { macro_call!() };`
2023-06-01 18:25:22 -05:00
error: aborting due to 26 previous errors