rust/tests/ui/manual_let_else_match.stderr

96 lines
3.1 KiB
Plaintext
Raw Normal View History

error: this could be rewritten as `let...else`
2023-06-27 06:09:28 -05:00
--> $DIR/manual_let_else_match.rs:36:5
2022-02-15 19:10:42 -06:00
|
LL | / let v = match g() {
LL | |
LL | |
2022-02-15 19:10:42 -06:00
LL | | Some(v_some) => v_some,
LL | | None => return,
LL | | };
| |______^ help: consider writing: `let Some(v) = g() else { return };`
2022-02-15 19:10:42 -06:00
|
= note: `-D clippy::manual-let-else` implied by `-D warnings`
error: this could be rewritten as `let...else`
--> $DIR/manual_let_else_match.rs:43:5
2022-02-15 19:10:42 -06:00
|
LL | / let v = match g() {
LL | |
2022-02-15 19:10:42 -06:00
LL | | Some(v_some) => v_some,
LL | | _ => return,
LL | | };
| |______^ help: consider writing: `let Some(v) = g() else { return };`
2022-02-15 19:10:42 -06:00
error: this could be rewritten as `let...else`
--> $DIR/manual_let_else_match.rs:51:9
2022-02-15 19:10:42 -06:00
|
LL | / let v = match h() {
LL | |
LL | | (Some(v), None) | (None, Some(v)) => v,
LL | | (Some(_), Some(_)) | (None, None) => continue,
LL | | };
| |__________^ help: consider writing: `let ((Some(v), None) | (None, Some(v))) = h() else { continue };`
error: this could be rewritten as `let...else`
--> $DIR/manual_let_else_match.rs:57:9
|
LL | / let v = match build_enum() {
LL | |
2022-02-15 19:10:42 -06:00
LL | | Variant::Bar(v) | Variant::Baz(v) => v,
LL | | _ => continue,
2022-02-15 19:10:42 -06:00
LL | | };
| |__________^ help: consider writing: `let (Variant::Bar(v) | Variant::Baz(v)) = build_enum() else { continue };`
2022-02-15 19:10:42 -06:00
error: this could be rewritten as `let...else`
--> $DIR/manual_let_else_match.rs:66:5
2022-02-15 19:10:42 -06:00
|
LL | / let v = match f() {
LL | |
2022-02-15 19:10:42 -06:00
LL | | Ok(v) => v,
LL | | Err(_) => return,
LL | | };
| |______^ help: consider writing: `let Ok(v) = f() else { return };`
2022-02-15 19:10:42 -06:00
error: this could be rewritten as `let...else`
--> $DIR/manual_let_else_match.rs:73:5
|
LL | / let v = match f().map_err(|_| ()) {
LL | |
LL | | Ok(v) => v,
LL | | Err(()) => return,
LL | | };
| |______^ help: consider writing: `let Ok(v) = f().map_err(|_| ()) else { return };`
error: this could be rewritten as `let...else`
--> $DIR/manual_let_else_match.rs:81:5
|
LL | / let _value = match f {
LL | |
LL | | Variant::Bar(v) | Variant::Baz(v) => v,
LL | | _ => return,
LL | | };
| |______^ help: consider writing: `let (Variant::Bar(_value) | Variant::Baz(_value)) = f else { return };`
error: this could be rewritten as `let...else`
--> $DIR/manual_let_else_match.rs:87:5
|
LL | / let _value = match Some(build_enum()) {
LL | |
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`
--> $DIR/manual_let_else_match.rs:94:5
|
LL | / let data = match data.as_slice() {
LL | |
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 };`
error: aborting due to 9 previous errors
2022-02-15 19:10:42 -06:00