mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-30 16:39:26 +00:00
85 lines
3.1 KiB
Text
85 lines
3.1 KiB
Text
error: this could be rewritten as `let...else`
|
|
--> $DIR/manual_let_else_match.rs:36:5
|
|
|
|
|
LL | / let v = match g() {
|
|
LL | | Some(v_some) => v_some,
|
|
LL | | None => return,
|
|
LL | | };
|
|
| |______^ 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`
|
|
--> $DIR/manual_let_else_match.rs:41:5
|
|
|
|
|
LL | / let v = match g() {
|
|
LL | | Some(v_some) => v_some,
|
|
LL | | _ => return,
|
|
LL | | };
|
|
| |______^ help: consider writing: `let Some(v) = g() else { return };`
|
|
|
|
error: this could be rewritten as `let...else`
|
|
--> $DIR/manual_let_else_match.rs:48:9
|
|
|
|
|
LL | / let v = match h() {
|
|
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:53:9
|
|
|
|
|
LL | / let v = match build_enum() {
|
|
LL | | Variant::Bar(v) | Variant::Baz(v) => v,
|
|
LL | | _ => continue,
|
|
LL | | };
|
|
| |__________^ help: consider writing: `let (Variant::Bar(v) | Variant::Baz(v)) = build_enum() else { continue };`
|
|
|
|
error: this could be rewritten as `let...else`
|
|
--> $DIR/manual_let_else_match.rs:61:5
|
|
|
|
|
LL | / let v = match f() {
|
|
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`
|
|
--> $DIR/manual_let_else_match.rs:67:5
|
|
|
|
|
LL | / let v = match f().map_err(|_| ()) {
|
|
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:74:5
|
|
|
|
|
LL | / let _value = match f {
|
|
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:79:5
|
|
|
|
|
LL | / let _value = match Some(build_enum()) {
|
|
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:85:5
|
|
|
|
|
LL | / let data = match data.as_slice() {
|
|
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
|
|
|