2022-11-21 19:34:47 +00:00
|
|
|
error: this could be rewritten as `let...else`
|
2024-02-27 14:25:18 +00:00
|
|
|
--> tests/ui/manual_let_else_match.rs:36:5
|
2022-11-21 19:34:47 +00:00
|
|
|
|
|
|
|
|
LL | / let v = match g() {
|
2023-08-24 19:32:12 +00:00
|
|
|
LL | |
|
|
|
|
LL | |
|
2022-11-21 19:34:47 +00:00
|
|
|
LL | | Some(v_some) => v_some,
|
|
|
|
LL | | None => return,
|
|
|
|
LL | | };
|
2023-05-20 13:39:26 +00:00
|
|
|
| |______^ help: consider writing: `let Some(v) = g() else { return };`
|
2022-11-21 19:34:47 +00:00
|
|
|
|
|
|
|
|
= note: `-D clippy::manual-let-else` implied by `-D warnings`
|
2023-08-01 12:02:21 +00:00
|
|
|
= help: to override `-D warnings` add `#[allow(clippy::manual_let_else)]`
|
2022-11-21 19:34:47 +00:00
|
|
|
|
|
|
|
error: this could be rewritten as `let...else`
|
2024-02-27 14:25:18 +00:00
|
|
|
--> tests/ui/manual_let_else_match.rs:43:5
|
2022-11-21 19:34:47 +00:00
|
|
|
|
|
|
|
|
LL | / let v = match g() {
|
2023-08-24 19:32:12 +00:00
|
|
|
LL | |
|
2022-11-21 19:34:47 +00:00
|
|
|
LL | | Some(v_some) => v_some,
|
|
|
|
LL | | _ => return,
|
|
|
|
LL | | };
|
2023-05-20 13:39:26 +00:00
|
|
|
| |______^ help: consider writing: `let Some(v) = g() else { return };`
|
2022-11-21 19:34:47 +00:00
|
|
|
|
|
|
|
error: this could be rewritten as `let...else`
|
2024-02-27 14:25:18 +00:00
|
|
|
--> tests/ui/manual_let_else_match.rs:51:9
|
2022-11-21 19:34:47 +00:00
|
|
|
|
|
|
|
|
LL | / let v = match h() {
|
2023-08-24 19:32:12 +00:00
|
|
|
LL | |
|
2022-11-21 19:34:47 +00:00
|
|
|
LL | | (Some(v), None) | (None, Some(v)) => v,
|
2023-02-26 00:08:29 +00:00
|
|
|
LL | | (Some(_), Some(_)) | (None, None) => continue,
|
2022-11-21 19:34:47 +00:00
|
|
|
LL | | };
|
2022-12-17 13:12:54 +00:00
|
|
|
| |__________^ help: consider writing: `let ((Some(v), None) | (None, Some(v))) = h() else { continue };`
|
2022-11-21 19:34:47 +00:00
|
|
|
|
|
|
|
error: this could be rewritten as `let...else`
|
2024-02-27 14:25:18 +00:00
|
|
|
--> tests/ui/manual_let_else_match.rs:57:9
|
2022-11-21 19:34:47 +00:00
|
|
|
|
|
|
|
|
LL | / let v = match build_enum() {
|
2023-08-24 19:32:12 +00:00
|
|
|
LL | |
|
2022-11-21 19:34:47 +00:00
|
|
|
LL | | Variant::Bar(v) | Variant::Baz(v) => v,
|
2023-02-26 00:08:29 +00:00
|
|
|
LL | | _ => continue,
|
2022-11-21 19:34:47 +00:00
|
|
|
LL | | };
|
2022-12-17 13:12:54 +00:00
|
|
|
| |__________^ help: consider writing: `let (Variant::Bar(v) | Variant::Baz(v)) = build_enum() else { continue };`
|
2022-11-21 19:34:47 +00:00
|
|
|
|
|
|
|
error: this could be rewritten as `let...else`
|
2024-02-27 14:25:18 +00:00
|
|
|
--> tests/ui/manual_let_else_match.rs:66:5
|
2022-11-21 19:34:47 +00:00
|
|
|
|
|
|
|
|
LL | / let v = match f() {
|
2023-08-24 19:32:12 +00:00
|
|
|
LL | |
|
2022-11-21 19:34:47 +00:00
|
|
|
LL | | Ok(v) => v,
|
|
|
|
LL | | Err(_) => return,
|
|
|
|
LL | | };
|
|
|
|
| |______^ help: consider writing: `let Ok(v) = f() else { return };`
|
|
|
|
|
|
|
|
error: this could be rewritten as `let...else`
|
2024-02-27 14:25:18 +00:00
|
|
|
--> tests/ui/manual_let_else_match.rs:73:5
|
2022-11-21 19:34:47 +00:00
|
|
|
|
|
|
|
|
LL | / let v = match f().map_err(|_| ()) {
|
2023-08-24 19:32:12 +00:00
|
|
|
LL | |
|
2022-11-21 19:34:47 +00:00
|
|
|
LL | | Ok(v) => v,
|
|
|
|
LL | | Err(()) => return,
|
|
|
|
LL | | };
|
|
|
|
| |______^ help: consider writing: `let Ok(v) = f().map_err(|_| ()) else { return };`
|
|
|
|
|
2022-12-17 13:12:54 +00:00
|
|
|
error: this could be rewritten as `let...else`
|
2024-02-27 14:25:18 +00:00
|
|
|
--> tests/ui/manual_let_else_match.rs:81:5
|
2022-12-17 13:12:54 +00:00
|
|
|
|
|
|
|
|
LL | / let _value = match f {
|
2023-08-24 19:32:12 +00:00
|
|
|
LL | |
|
2023-06-02 09:41:57 +00:00
|
|
|
LL | | Variant::Bar(v) | Variant::Baz(v) => v,
|
2022-12-17 13:12:54 +00:00
|
|
|
LL | | _ => return,
|
|
|
|
LL | | };
|
2023-06-02 09:41:57 +00:00
|
|
|
| |______^ help: consider writing: `let (Variant::Bar(_value) | Variant::Baz(_value)) = f else { return };`
|
2022-12-17 13:12:54 +00:00
|
|
|
|
2023-02-26 00:08:29 +00:00
|
|
|
error: this could be rewritten as `let...else`
|
2024-02-27 14:25:18 +00:00
|
|
|
--> tests/ui/manual_let_else_match.rs:87:5
|
2023-07-02 12:35:19 +00:00
|
|
|
|
|
|
|
|
LL | / let _value = match Some(build_enum()) {
|
2023-08-24 19:32:12 +00:00
|
|
|
LL | |
|
2023-07-02 12:35:19 +00:00
|
|
|
LL | | Some(Variant::Bar(v) | Variant::Baz(v)) => v,
|
|
|
|
LL | | _ => return,
|
|
|
|
LL | | };
|
|
|
|
| |______^ help: consider writing: `let Some(Variant::Bar(_value) | Variant::Baz(_value)) = Some(build_enum()) else { return };`
|
|
|
|
|
|
|
|
error: this could be rewritten as `let...else`
|
2024-02-27 14:25:18 +00:00
|
|
|
--> tests/ui/manual_let_else_match.rs:94:5
|
2023-02-26 00:08:29 +00:00
|
|
|
|
|
|
|
|
LL | / let data = match data.as_slice() {
|
2023-08-24 19:32:12 +00:00
|
|
|
LL | |
|
2023-02-26 00:08:29 +00:00
|
|
|
LL | | [data @ .., 0, 0, 0, 0] | [data @ .., 0, 0] | [data @ .., 0] => data,
|
|
|
|
LL | | _ => return,
|
|
|
|
LL | | };
|
|
|
|
| |______^ help: consider writing: `let ([data @ .., 0, 0, 0, 0] | [data @ .., 0, 0] | [data @ .., 0]) = data.as_slice() else { return };`
|
|
|
|
|
2023-10-06 15:35:45 +00:00
|
|
|
error: this could be rewritten as `let...else`
|
2024-02-27 14:25:18 +00:00
|
|
|
--> tests/ui/manual_let_else_match.rs:175:5
|
2023-10-06 15:35:45 +00:00
|
|
|
|
|
|
|
|
LL | / let msg = match Some("hi") {
|
|
|
|
LL | |
|
|
|
|
LL | | Some(m) => m,
|
|
|
|
LL | | _ => unreachable!("can't happen"),
|
|
|
|
LL | | };
|
|
|
|
| |______^ help: consider writing: `let Some(msg) = Some("hi") else { unreachable!("can't happen") };`
|
|
|
|
|
|
|
|
error: aborting due to 10 previous errors
|
2022-11-21 19:34:47 +00:00
|
|
|
|