Update ui test

This commit is contained in:
Guillaume Gomez 2024-03-08 22:04:17 +01:00
parent fadb254073
commit b0f358fd3c
14 changed files with 113 additions and 98 deletions

View File

@ -8,7 +8,8 @@
clippy::never_loop, clippy::never_loop,
clippy::needless_if, clippy::needless_if,
clippy::diverging_sub_expression, clippy::diverging_sub_expression,
clippy::single_match clippy::single_match,
clippy::manual_unwrap_or_default
)] )]
#![warn(clippy::manual_let_else)] #![warn(clippy::manual_let_else)]
//@no-rustfix //@no-rustfix

View File

@ -1,5 +1,5 @@
error: this could be rewritten as `let...else` error: this could be rewritten as `let...else`
--> tests/ui/manual_let_else.rs:28:5 --> tests/ui/manual_let_else.rs:29:5
| |
LL | let v = if let Some(v_some) = g() { v_some } else { return }; LL | let v = if let Some(v_some) = g() { v_some } else { return };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider writing: `let Some(v) = g() else { return };` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider writing: `let Some(v) = g() else { return };`
@ -8,7 +8,7 @@ LL | let v = if let Some(v_some) = g() { v_some } else { return };
= help: to override `-D warnings` add `#[allow(clippy::manual_let_else)]` = help: to override `-D warnings` add `#[allow(clippy::manual_let_else)]`
error: this could be rewritten as `let...else` error: this could be rewritten as `let...else`
--> tests/ui/manual_let_else.rs:31:5 --> tests/ui/manual_let_else.rs:32:5
| |
LL | / let v = if let Some(v_some) = g() { LL | / let v = if let Some(v_some) = g() {
LL | | LL | |
@ -26,7 +26,7 @@ LL + };
| |
error: this could be rewritten as `let...else` error: this could be rewritten as `let...else`
--> tests/ui/manual_let_else.rs:38:5 --> tests/ui/manual_let_else.rs:39:5
| |
LL | / let v = if let Some(v) = g() { LL | / let v = if let Some(v) = g() {
LL | | LL | |
@ -47,25 +47,25 @@ LL + };
| |
error: this could be rewritten as `let...else` error: this could be rewritten as `let...else`
--> tests/ui/manual_let_else.rs:50:9 --> tests/ui/manual_let_else.rs:51:9
| |
LL | let v = if let Some(v_some) = g() { v_some } else { continue }; LL | let v = if let Some(v_some) = g() { v_some } else { continue };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider writing: `let Some(v) = g() else { continue };` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider writing: `let Some(v) = g() else { continue };`
error: this could be rewritten as `let...else` error: this could be rewritten as `let...else`
--> tests/ui/manual_let_else.rs:52:9 --> tests/ui/manual_let_else.rs:53:9
| |
LL | let v = if let Some(v_some) = g() { v_some } else { break }; LL | let v = if let Some(v_some) = g() { v_some } else { break };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider writing: `let Some(v) = g() else { break };` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider writing: `let Some(v) = g() else { break };`
error: this could be rewritten as `let...else` error: this could be rewritten as `let...else`
--> tests/ui/manual_let_else.rs:57:5 --> tests/ui/manual_let_else.rs:58:5
| |
LL | let v = if let Some(v_some) = g() { v_some } else { panic!() }; LL | let v = if let Some(v_some) = g() { v_some } else { panic!() };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider writing: `let Some(v) = g() else { panic!() };` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider writing: `let Some(v) = g() else { panic!() };`
error: this could be rewritten as `let...else` error: this could be rewritten as `let...else`
--> tests/ui/manual_let_else.rs:61:5 --> tests/ui/manual_let_else.rs:62:5
| |
LL | / let v = if let Some(v_some) = g() { LL | / let v = if let Some(v_some) = g() {
LL | | LL | |
@ -83,7 +83,7 @@ LL + };
| |
error: this could be rewritten as `let...else` error: this could be rewritten as `let...else`
--> tests/ui/manual_let_else.rs:69:5 --> tests/ui/manual_let_else.rs:70:5
| |
LL | / let v = if let Some(v_some) = g() { LL | / let v = if let Some(v_some) = g() {
LL | | LL | |
@ -101,7 +101,7 @@ LL + };
| |
error: this could be rewritten as `let...else` error: this could be rewritten as `let...else`
--> tests/ui/manual_let_else.rs:77:5 --> tests/ui/manual_let_else.rs:78:5
| |
LL | / let v = if let Some(v_some) = g() { LL | / let v = if let Some(v_some) = g() {
LL | | LL | |
@ -121,7 +121,7 @@ LL + };
| |
error: this could be rewritten as `let...else` error: this could be rewritten as `let...else`
--> tests/ui/manual_let_else.rs:86:5 --> tests/ui/manual_let_else.rs:87:5
| |
LL | / let v = if let Some(v_some) = g() { LL | / let v = if let Some(v_some) = g() {
LL | | LL | |
@ -141,7 +141,7 @@ LL + };
| |
error: this could be rewritten as `let...else` error: this could be rewritten as `let...else`
--> tests/ui/manual_let_else.rs:95:5 --> tests/ui/manual_let_else.rs:96:5
| |
LL | / let v = if let Some(v_some) = g() { LL | / let v = if let Some(v_some) = g() {
LL | | LL | |
@ -168,7 +168,7 @@ LL + };
| |
error: this could be rewritten as `let...else` error: this could be rewritten as `let...else`
--> tests/ui/manual_let_else.rs:111:5 --> tests/ui/manual_let_else.rs:112:5
| |
LL | / let v = if let Some(v_some) = g() { LL | / let v = if let Some(v_some) = g() {
LL | | LL | |
@ -190,7 +190,7 @@ LL + };
| |
error: this could be rewritten as `let...else` error: this could be rewritten as `let...else`
--> tests/ui/manual_let_else.rs:122:5 --> tests/ui/manual_let_else.rs:123:5
| |
LL | / let v = if let Some(v_some) = g() { LL | / let v = if let Some(v_some) = g() {
LL | | LL | |
@ -217,7 +217,7 @@ LL + };
| |
error: this could be rewritten as `let...else` error: this could be rewritten as `let...else`
--> tests/ui/manual_let_else.rs:138:5 --> tests/ui/manual_let_else.rs:139:5
| |
LL | / let v = if let Some(v_some) = g() { LL | / let v = if let Some(v_some) = g() {
LL | | LL | |
@ -239,7 +239,7 @@ LL + };
| |
error: this could be rewritten as `let...else` error: this could be rewritten as `let...else`
--> tests/ui/manual_let_else.rs:149:5 --> tests/ui/manual_let_else.rs:150:5
| |
LL | / let v = if let Some(v_some) = g() { LL | / let v = if let Some(v_some) = g() {
LL | | LL | |
@ -257,7 +257,7 @@ LL + };
| |
error: this could be rewritten as `let...else` error: this could be rewritten as `let...else`
--> tests/ui/manual_let_else.rs:157:5 --> tests/ui/manual_let_else.rs:158:5
| |
LL | / let v = if let Some(v_some) = g() { LL | / let v = if let Some(v_some) = g() {
LL | | LL | |
@ -278,7 +278,7 @@ LL + };
| |
error: this could be rewritten as `let...else` error: this could be rewritten as `let...else`
--> tests/ui/manual_let_else.rs:167:5 --> tests/ui/manual_let_else.rs:168:5
| |
LL | / let v = if let Some(v_some) = g() { LL | / let v = if let Some(v_some) = g() {
LL | | LL | |
@ -299,7 +299,7 @@ LL + } };
| |
error: this could be rewritten as `let...else` error: this could be rewritten as `let...else`
--> tests/ui/manual_let_else.rs:177:5 --> tests/ui/manual_let_else.rs:178:5
| |
LL | / let v = if let Some(v_some) = g() { LL | / let v = if let Some(v_some) = g() {
LL | | LL | |
@ -328,7 +328,7 @@ LL + };
| |
error: this could be rewritten as `let...else` error: this could be rewritten as `let...else`
--> tests/ui/manual_let_else.rs:195:5 --> tests/ui/manual_let_else.rs:196:5
| |
LL | / let (v, w) = if let Some(v_some) = g().map(|v| (v, 42)) { LL | / let (v, w) = if let Some(v_some) = g().map(|v| (v, 42)) {
LL | | LL | |
@ -346,7 +346,7 @@ LL + };
| |
error: this could be rewritten as `let...else` error: this could be rewritten as `let...else`
--> tests/ui/manual_let_else.rs:203:5 --> tests/ui/manual_let_else.rs:204:5
| |
LL | / let (w, S { v }) = if let (Some(v_some), w_some) = (g().map(|_| S { v: 0 }), 0) { LL | / let (w, S { v }) = if let (Some(v_some), w_some) = (g().map(|_| S { v: 0 }), 0) {
LL | | LL | |
@ -364,7 +364,7 @@ LL + };
| |
error: this could be rewritten as `let...else` error: this could be rewritten as `let...else`
--> tests/ui/manual_let_else.rs:213:13 --> tests/ui/manual_let_else.rs:214:13
| |
LL | let $n = if let Some(v) = $e { v } else { return }; LL | let $n = if let Some(v) = $e { v } else { return };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider writing: `let Some($n) = g() else { return };` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider writing: `let Some($n) = g() else { return };`
@ -375,19 +375,19 @@ LL | create_binding_if_some!(w, g());
= note: this error originates in the macro `create_binding_if_some` (in Nightly builds, run with -Z macro-backtrace for more info) = 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` error: this could be rewritten as `let...else`
--> tests/ui/manual_let_else.rs:222:5 --> tests/ui/manual_let_else.rs:223:5
| |
LL | let v = if let Variant::A(a, 0) = e() { a } else { return }; LL | let v = if let Variant::A(a, 0) = e() { a } else { return };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider writing: `let Variant::A(v, 0) = e() else { return };` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider writing: `let Variant::A(v, 0) = e() else { return };`
error: this could be rewritten as `let...else` error: this could be rewritten as `let...else`
--> tests/ui/manual_let_else.rs:226:5 --> tests/ui/manual_let_else.rs:227:5
| |
LL | let mut v = if let Variant::B(b) = e() { b } else { return }; LL | let mut v = if let Variant::B(b) = e() { b } else { return };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider writing: `let Variant::B(mut v) = e() else { return };` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider writing: `let Variant::B(mut v) = e() else { return };`
error: this could be rewritten as `let...else` error: this could be rewritten as `let...else`
--> tests/ui/manual_let_else.rs:231:5 --> tests/ui/manual_let_else.rs:232:5
| |
LL | / let v = if let Ok(Some(Variant::B(b))) | Err(Some(Variant::A(b, _))) = nested { LL | / let v = if let Ok(Some(Variant::B(b))) | Err(Some(Variant::A(b, _))) = nested {
LL | | LL | |
@ -405,19 +405,19 @@ LL + };
| |
error: this could be rewritten as `let...else` error: this could be rewritten as `let...else`
--> tests/ui/manual_let_else.rs:238:5 --> tests/ui/manual_let_else.rs:239:5
| |
LL | let v = if let Variant::A(.., a) = e() { a } else { return }; LL | let v = if let Variant::A(.., a) = e() { a } else { return };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider writing: `let Variant::A(.., v) = e() else { return };` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider writing: `let Variant::A(.., v) = e() else { return };`
error: this could be rewritten as `let...else` error: this could be rewritten as `let...else`
--> tests/ui/manual_let_else.rs:242:5 --> tests/ui/manual_let_else.rs:243:5
| |
LL | let w = if let (Some(v), ()) = (g(), ()) { v } else { return }; LL | let w = if let (Some(v), ()) = (g(), ()) { v } else { return };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider writing: `let (Some(w), ()) = (g(), ()) else { return };` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider writing: `let (Some(w), ()) = (g(), ()) else { return };`
error: this could be rewritten as `let...else` error: this could be rewritten as `let...else`
--> tests/ui/manual_let_else.rs:246:5 --> tests/ui/manual_let_else.rs:247:5
| |
LL | / let w = if let Some(S { v: x }) = Some(S { v: 0 }) { LL | / let w = if let Some(S { v: x }) = Some(S { v: 0 }) {
LL | | LL | |
@ -435,7 +435,7 @@ LL + };
| |
error: this could be rewritten as `let...else` error: this could be rewritten as `let...else`
--> tests/ui/manual_let_else.rs:254:5 --> tests/ui/manual_let_else.rs:255:5
| |
LL | / let v = if let Some(S { v: x }) = Some(S { v: 0 }) { LL | / let v = if let Some(S { v: x }) = Some(S { v: 0 }) {
LL | | LL | |
@ -453,7 +453,7 @@ LL + };
| |
error: this could be rewritten as `let...else` error: this could be rewritten as `let...else`
--> tests/ui/manual_let_else.rs:262:5 --> tests/ui/manual_let_else.rs:263:5
| |
LL | / let (x, S { v }, w) = if let Some(U { v, w, x }) = None::<U<S<()>>> { LL | / let (x, S { v }, w) = if let Some(U { v, w, x }) = None::<U<S<()>>> {
LL | | LL | |
@ -471,7 +471,7 @@ LL + };
| |
error: this could be rewritten as `let...else` error: this could be rewritten as `let...else`
--> tests/ui/manual_let_else.rs:379:5 --> tests/ui/manual_let_else.rs:380:5
| |
LL | / let _ = match ff { LL | / let _ = match ff {
LL | | LL | |
@ -481,7 +481,7 @@ LL | | };
| |______^ help: consider writing: `let Some(_) = ff else { macro_call!() };` | |______^ help: consider writing: `let Some(_) = ff else { macro_call!() };`
error: this could be rewritten as `let...else` error: this could be rewritten as `let...else`
--> tests/ui/manual_let_else.rs:456:9 --> tests/ui/manual_let_else.rs:457:9
| |
LL | let v = if let Some(v_some) = g() { v_some } else { return }; LL | let v = if let Some(v_some) = g() { v_some } else { return };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider writing: `let Some(v) = g() else { return };` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider writing: `let Some(v) = g() else { return };`

View File

@ -1,5 +1,10 @@
#![allow(dead_code)] #![allow(dead_code)]
#![allow(unused_variables, clippy::unnecessary_wraps, clippy::unnecessary_literal_unwrap)] #![allow(
unused_variables,
clippy::unnecessary_wraps,
clippy::unnecessary_literal_unwrap,
clippy::manual_unwrap_or_default
)]
fn option_unwrap_or() { fn option_unwrap_or() {
// int case // int case

View File

@ -1,5 +1,10 @@
#![allow(dead_code)] #![allow(dead_code)]
#![allow(unused_variables, clippy::unnecessary_wraps, clippy::unnecessary_literal_unwrap)] #![allow(
unused_variables,
clippy::unnecessary_wraps,
clippy::unnecessary_literal_unwrap,
clippy::manual_unwrap_or_default
)]
fn option_unwrap_or() { fn option_unwrap_or() {
// int case // int case

View File

@ -1,5 +1,5 @@
error: this pattern reimplements `Option::unwrap_or` error: this pattern reimplements `Option::unwrap_or`
--> tests/ui/manual_unwrap_or.rs:6:5 --> tests/ui/manual_unwrap_or.rs:11:5
| |
LL | / match Some(1) { LL | / match Some(1) {
LL | | Some(i) => i, LL | | Some(i) => i,
@ -11,7 +11,7 @@ LL | | };
= help: to override `-D warnings` add `#[allow(clippy::manual_unwrap_or)]` = help: to override `-D warnings` add `#[allow(clippy::manual_unwrap_or)]`
error: this pattern reimplements `Option::unwrap_or` error: this pattern reimplements `Option::unwrap_or`
--> tests/ui/manual_unwrap_or.rs:12:5 --> tests/ui/manual_unwrap_or.rs:17:5
| |
LL | / match Some(1) { LL | / match Some(1) {
LL | | None => 42, LL | | None => 42,
@ -20,7 +20,7 @@ LL | | };
| |_____^ help: replace with: `Some(1).unwrap_or(42)` | |_____^ help: replace with: `Some(1).unwrap_or(42)`
error: this pattern reimplements `Option::unwrap_or` error: this pattern reimplements `Option::unwrap_or`
--> tests/ui/manual_unwrap_or.rs:18:5 --> tests/ui/manual_unwrap_or.rs:23:5
| |
LL | / match Some(1) { LL | / match Some(1) {
LL | | Some(i) => i, LL | | Some(i) => i,
@ -29,7 +29,7 @@ LL | | };
| |_____^ help: replace with: `Some(1).unwrap_or(1 + 42)` | |_____^ help: replace with: `Some(1).unwrap_or(1 + 42)`
error: this pattern reimplements `Option::unwrap_or` error: this pattern reimplements `Option::unwrap_or`
--> tests/ui/manual_unwrap_or.rs:25:5 --> tests/ui/manual_unwrap_or.rs:30:5
| |
LL | / match Some(1) { LL | / match Some(1) {
LL | | Some(i) => i, LL | | Some(i) => i,
@ -50,7 +50,7 @@ LL ~ });
| |
error: this pattern reimplements `Option::unwrap_or` error: this pattern reimplements `Option::unwrap_or`
--> tests/ui/manual_unwrap_or.rs:35:5 --> tests/ui/manual_unwrap_or.rs:40:5
| |
LL | / match Some("Bob") { LL | / match Some("Bob") {
LL | | Some(i) => i, LL | | Some(i) => i,
@ -59,7 +59,7 @@ LL | | };
| |_____^ help: replace with: `Some("Bob").unwrap_or("Alice")` | |_____^ help: replace with: `Some("Bob").unwrap_or("Alice")`
error: this pattern reimplements `Result::unwrap_or` error: this pattern reimplements `Result::unwrap_or`
--> tests/ui/manual_unwrap_or.rs:85:5 --> tests/ui/manual_unwrap_or.rs:90:5
| |
LL | / match Ok::<i32, &str>(1) { LL | / match Ok::<i32, &str>(1) {
LL | | Ok(i) => i, LL | | Ok(i) => i,
@ -68,7 +68,7 @@ LL | | };
| |_____^ help: replace with: `Ok::<i32, &str>(1).unwrap_or(42)` | |_____^ help: replace with: `Ok::<i32, &str>(1).unwrap_or(42)`
error: this pattern reimplements `Result::unwrap_or` error: this pattern reimplements `Result::unwrap_or`
--> tests/ui/manual_unwrap_or.rs:92:5 --> tests/ui/manual_unwrap_or.rs:97:5
| |
LL | / match a { LL | / match a {
LL | | Ok(i) => i, LL | | Ok(i) => i,
@ -77,7 +77,7 @@ LL | | };
| |_____^ help: replace with: `a.unwrap_or(42)` | |_____^ help: replace with: `a.unwrap_or(42)`
error: this pattern reimplements `Result::unwrap_or` error: this pattern reimplements `Result::unwrap_or`
--> tests/ui/manual_unwrap_or.rs:98:5 --> tests/ui/manual_unwrap_or.rs:103:5
| |
LL | / match Ok(1) as Result<i32, &str> { LL | / match Ok(1) as Result<i32, &str> {
LL | | Ok(i) => i, LL | | Ok(i) => i,
@ -86,7 +86,7 @@ LL | | };
| |_____^ help: replace with: `(Ok(1) as Result<i32, &str>).unwrap_or(42)` | |_____^ help: replace with: `(Ok(1) as Result<i32, &str>).unwrap_or(42)`
error: this pattern reimplements `Option::unwrap_or` error: this pattern reimplements `Option::unwrap_or`
--> tests/ui/manual_unwrap_or.rs:111:5 --> tests/ui/manual_unwrap_or.rs:116:5
| |
LL | / match s.method() { LL | / match s.method() {
LL | | Some(i) => i, LL | | Some(i) => i,
@ -95,7 +95,7 @@ LL | | };
| |_____^ help: replace with: `s.method().unwrap_or(42)` | |_____^ help: replace with: `s.method().unwrap_or(42)`
error: this pattern reimplements `Result::unwrap_or` error: this pattern reimplements `Result::unwrap_or`
--> tests/ui/manual_unwrap_or.rs:117:5 --> tests/ui/manual_unwrap_or.rs:122:5
| |
LL | / match Ok::<i32, &str>(1) { LL | / match Ok::<i32, &str>(1) {
LL | | Err(_) => 42, LL | | Err(_) => 42,
@ -104,7 +104,7 @@ LL | | };
| |_____^ help: replace with: `Ok::<i32, &str>(1).unwrap_or(42)` | |_____^ help: replace with: `Ok::<i32, &str>(1).unwrap_or(42)`
error: this pattern reimplements `Result::unwrap_or` error: this pattern reimplements `Result::unwrap_or`
--> tests/ui/manual_unwrap_or.rs:123:5 --> tests/ui/manual_unwrap_or.rs:128:5
| |
LL | / match Ok::<i32, &str>(1) { LL | / match Ok::<i32, &str>(1) {
LL | | Ok(i) => i, LL | | Ok(i) => i,
@ -113,7 +113,7 @@ LL | | };
| |_____^ help: replace with: `Ok::<i32, &str>(1).unwrap_or(1 + 42)` | |_____^ help: replace with: `Ok::<i32, &str>(1).unwrap_or(1 + 42)`
error: this pattern reimplements `Result::unwrap_or` error: this pattern reimplements `Result::unwrap_or`
--> tests/ui/manual_unwrap_or.rs:130:5 --> tests/ui/manual_unwrap_or.rs:135:5
| |
LL | / match Ok::<i32, &str>(1) { LL | / match Ok::<i32, &str>(1) {
LL | | Ok(i) => i, LL | | Ok(i) => i,
@ -134,7 +134,7 @@ LL ~ });
| |
error: this pattern reimplements `Result::unwrap_or` error: this pattern reimplements `Result::unwrap_or`
--> tests/ui/manual_unwrap_or.rs:140:5 --> tests/ui/manual_unwrap_or.rs:145:5
| |
LL | / match Ok::<&str, &str>("Bob") { LL | / match Ok::<&str, &str>("Bob") {
LL | | Ok(i) => i, LL | | Ok(i) => i,
@ -143,7 +143,7 @@ LL | | };
| |_____^ help: replace with: `Ok::<&str, &str>("Bob").unwrap_or("Alice")` | |_____^ help: replace with: `Ok::<&str, &str>("Bob").unwrap_or("Alice")`
error: this pattern reimplements `Option::unwrap_or` error: this pattern reimplements `Option::unwrap_or`
--> tests/ui/manual_unwrap_or.rs:200:17 --> tests/ui/manual_unwrap_or.rs:205:17
| |
LL | let _ = match some_macro!() { LL | let _ = match some_macro!() {
| _________________^ | _________________^

View File

@ -1,6 +1,6 @@
#![warn(clippy::match_result_ok)] #![warn(clippy::match_result_ok)]
#![allow(dead_code)] #![allow(dead_code)]
#![allow(clippy::boxed_local, clippy::uninlined_format_args)] #![allow(clippy::boxed_local, clippy::uninlined_format_args, clippy::manual_unwrap_or_default)]
// Checking `if` cases // Checking `if` cases

View File

@ -1,6 +1,6 @@
#![warn(clippy::match_result_ok)] #![warn(clippy::match_result_ok)]
#![allow(dead_code)] #![allow(dead_code)]
#![allow(clippy::boxed_local, clippy::uninlined_format_args)] #![allow(clippy::boxed_local, clippy::uninlined_format_args, clippy::manual_unwrap_or_default)]
// Checking `if` cases // Checking `if` cases

View File

@ -3,7 +3,8 @@
clippy::ref_option_ref, clippy::ref_option_ref,
clippy::equatable_if_let, clippy::equatable_if_let,
clippy::let_unit_value, clippy::let_unit_value,
clippy::redundant_locals clippy::redundant_locals,
clippy::manual_unwrap_or_default
)] )]
fn bad1(string: Option<&str>) -> (bool, &str) { fn bad1(string: Option<&str>) -> (bool, &str) {

View File

@ -3,7 +3,8 @@
clippy::ref_option_ref, clippy::ref_option_ref,
clippy::equatable_if_let, clippy::equatable_if_let,
clippy::let_unit_value, clippy::let_unit_value,
clippy::redundant_locals clippy::redundant_locals,
clippy::manual_unwrap_or_default
)] )]
fn bad1(string: Option<&str>) -> (bool, &str) { fn bad1(string: Option<&str>) -> (bool, &str) {

View File

@ -1,5 +1,5 @@
error: use Option::map_or instead of an if let/else error: use Option::map_or instead of an if let/else
--> tests/ui/option_if_let_else.rs:10:5 --> tests/ui/option_if_let_else.rs:11:5
| |
LL | / if let Some(x) = string { LL | / if let Some(x) = string {
LL | | (true, x) LL | | (true, x)
@ -12,19 +12,19 @@ LL | | }
= help: to override `-D warnings` add `#[allow(clippy::option_if_let_else)]` = help: to override `-D warnings` add `#[allow(clippy::option_if_let_else)]`
error: use Option::map_or instead of an if let/else error: use Option::map_or instead of an if let/else
--> tests/ui/option_if_let_else.rs:28:13 --> tests/ui/option_if_let_else.rs:29:13
| |
LL | let _ = if let Some(s) = *string { s.len() } else { 0 }; LL | let _ = if let Some(s) = *string { s.len() } else { 0 };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `string.map_or(0, |s| s.len())` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `string.map_or(0, |s| s.len())`
error: use Option::map_or instead of an if let/else error: use Option::map_or instead of an if let/else
--> tests/ui/option_if_let_else.rs:29:13 --> tests/ui/option_if_let_else.rs:30:13
| |
LL | let _ = if let Some(s) = &num { s } else { &0 }; LL | let _ = if let Some(s) = &num { s } else { &0 };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `num.as_ref().map_or(&0, |s| s)` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `num.as_ref().map_or(&0, |s| s)`
error: use Option::map_or instead of an if let/else error: use Option::map_or instead of an if let/else
--> tests/ui/option_if_let_else.rs:30:13 --> tests/ui/option_if_let_else.rs:31:13
| |
LL | let _ = if let Some(s) = &mut num { LL | let _ = if let Some(s) = &mut num {
| _____________^ | _____________^
@ -44,13 +44,13 @@ LL ~ });
| |
error: use Option::map_or instead of an if let/else error: use Option::map_or instead of an if let/else
--> tests/ui/option_if_let_else.rs:36:13 --> tests/ui/option_if_let_else.rs:37:13
| |
LL | let _ = if let Some(ref s) = num { s } else { &0 }; LL | let _ = if let Some(ref s) = num { s } else { &0 };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `num.as_ref().map_or(&0, |s| s)` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `num.as_ref().map_or(&0, |s| s)`
error: use Option::map_or instead of an if let/else error: use Option::map_or instead of an if let/else
--> tests/ui/option_if_let_else.rs:37:13 --> tests/ui/option_if_let_else.rs:38:13
| |
LL | let _ = if let Some(mut s) = num { LL | let _ = if let Some(mut s) = num {
| _____________^ | _____________^
@ -70,7 +70,7 @@ LL ~ });
| |
error: use Option::map_or instead of an if let/else error: use Option::map_or instead of an if let/else
--> tests/ui/option_if_let_else.rs:43:13 --> tests/ui/option_if_let_else.rs:44:13
| |
LL | let _ = if let Some(ref mut s) = num { LL | let _ = if let Some(ref mut s) = num {
| _____________^ | _____________^
@ -90,7 +90,7 @@ LL ~ });
| |
error: use Option::map_or instead of an if let/else error: use Option::map_or instead of an if let/else
--> tests/ui/option_if_let_else.rs:52:5 --> tests/ui/option_if_let_else.rs:53:5
| |
LL | / if let Some(x) = arg { LL | / if let Some(x) = arg {
LL | | let y = x * x; LL | | let y = x * x;
@ -109,7 +109,7 @@ LL + })
| |
error: use Option::map_or_else instead of an if let/else error: use Option::map_or_else instead of an if let/else
--> tests/ui/option_if_let_else.rs:65:13 --> tests/ui/option_if_let_else.rs:66:13
| |
LL | let _ = if let Some(x) = arg { LL | let _ = if let Some(x) = arg {
| _____________^ | _____________^
@ -121,7 +121,7 @@ LL | | };
| |_____^ help: try: `arg.map_or_else(side_effect, |x| x)` | |_____^ help: try: `arg.map_or_else(side_effect, |x| x)`
error: use Option::map_or_else instead of an if let/else error: use Option::map_or_else instead of an if let/else
--> tests/ui/option_if_let_else.rs:74:13 --> tests/ui/option_if_let_else.rs:75:13
| |
LL | let _ = if let Some(x) = arg { LL | let _ = if let Some(x) = arg {
| _____________^ | _____________^
@ -144,7 +144,7 @@ LL ~ }, |x| x * x * x * x);
| |
error: use Option::map_or_else instead of an if let/else error: use Option::map_or_else instead of an if let/else
--> tests/ui/option_if_let_else.rs:107:13 --> tests/ui/option_if_let_else.rs:108:13
| |
LL | / if let Some(idx) = s.find('.') { LL | / if let Some(idx) = s.find('.') {
LL | | vec![s[..idx].to_string(), s[idx..].to_string()] LL | | vec![s[..idx].to_string(), s[idx..].to_string()]
@ -154,7 +154,7 @@ LL | | }
| |_____________^ help: try: `s.find('.').map_or_else(|| vec![s.to_string()], |idx| vec![s[..idx].to_string(), s[idx..].to_string()])` | |_____________^ help: try: `s.find('.').map_or_else(|| vec![s.to_string()], |idx| vec![s[..idx].to_string(), s[idx..].to_string()])`
error: use Option::map_or_else instead of an if let/else error: use Option::map_or_else instead of an if let/else
--> tests/ui/option_if_let_else.rs:118:5 --> tests/ui/option_if_let_else.rs:119:5
| |
LL | / if let Ok(binding) = variable { LL | / if let Ok(binding) = variable {
LL | | println!("Ok {binding}"); LL | | println!("Ok {binding}");
@ -177,13 +177,13 @@ LL + })
| |
error: use Option::map_or instead of an if let/else error: use Option::map_or instead of an if let/else
--> tests/ui/option_if_let_else.rs:142:13 --> tests/ui/option_if_let_else.rs:143:13
| |
LL | let _ = if let Some(x) = optional { x + 2 } else { 5 }; LL | let _ = if let Some(x) = optional { x + 2 } else { 5 };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `optional.map_or(5, |x| x + 2)` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `optional.map_or(5, |x| x + 2)`
error: use Option::map_or instead of an if let/else error: use Option::map_or instead of an if let/else
--> tests/ui/option_if_let_else.rs:152:13 --> tests/ui/option_if_let_else.rs:153:13
| |
LL | let _ = if let Some(x) = Some(0) { LL | let _ = if let Some(x) = Some(0) {
| _____________^ | _____________^
@ -205,13 +205,13 @@ LL ~ });
| |
error: use Option::map_or instead of an if let/else error: use Option::map_or instead of an if let/else
--> tests/ui/option_if_let_else.rs:180:13 --> tests/ui/option_if_let_else.rs:181:13
| |
LL | let _ = if let Some(x) = Some(0) { s.len() + x } else { s.len() }; LL | let _ = if let Some(x) = Some(0) { s.len() + x } else { s.len() };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `Some(0).map_or(s.len(), |x| s.len() + x)` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `Some(0).map_or(s.len(), |x| s.len() + x)`
error: use Option::map_or instead of an if let/else error: use Option::map_or instead of an if let/else
--> tests/ui/option_if_let_else.rs:184:13 --> tests/ui/option_if_let_else.rs:185:13
| |
LL | let _ = if let Some(x) = Some(0) { LL | let _ = if let Some(x) = Some(0) {
| _____________^ | _____________^
@ -231,7 +231,7 @@ LL ~ });
| |
error: use Option::map_or instead of an if let/else error: use Option::map_or instead of an if let/else
--> tests/ui/option_if_let_else.rs:223:13 --> tests/ui/option_if_let_else.rs:224:13
| |
LL | let _ = match s { LL | let _ = match s {
| _____________^ | _____________^
@ -241,7 +241,7 @@ LL | | };
| |_____^ help: try: `s.map_or(1, |string| string.len())` | |_____^ help: try: `s.map_or(1, |string| string.len())`
error: use Option::map_or instead of an if let/else error: use Option::map_or instead of an if let/else
--> tests/ui/option_if_let_else.rs:227:13 --> tests/ui/option_if_let_else.rs:228:13
| |
LL | let _ = match Some(10) { LL | let _ = match Some(10) {
| _____________^ | _____________^
@ -251,7 +251,7 @@ LL | | };
| |_____^ help: try: `Some(10).map_or(5, |a| a + 1)` | |_____^ help: try: `Some(10).map_or(5, |a| a + 1)`
error: use Option::map_or instead of an if let/else error: use Option::map_or instead of an if let/else
--> tests/ui/option_if_let_else.rs:233:13 --> tests/ui/option_if_let_else.rs:234:13
| |
LL | let _ = match res { LL | let _ = match res {
| _____________^ | _____________^
@ -261,7 +261,7 @@ LL | | };
| |_____^ help: try: `res.map_or(1, |a| a + 1)` | |_____^ help: try: `res.map_or(1, |a| a + 1)`
error: use Option::map_or instead of an if let/else error: use Option::map_or instead of an if let/else
--> tests/ui/option_if_let_else.rs:237:13 --> tests/ui/option_if_let_else.rs:238:13
| |
LL | let _ = match res { LL | let _ = match res {
| _____________^ | _____________^
@ -271,13 +271,13 @@ LL | | };
| |_____^ help: try: `res.map_or(1, |a| a + 1)` | |_____^ help: try: `res.map_or(1, |a| a + 1)`
error: use Option::map_or instead of an if let/else error: use Option::map_or instead of an if let/else
--> tests/ui/option_if_let_else.rs:241:13 --> tests/ui/option_if_let_else.rs:242:13
| |
LL | let _ = if let Ok(a) = res { a + 1 } else { 5 }; LL | let _ = if let Ok(a) = res { a + 1 } else { 5 };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `res.map_or(5, |a| a + 1)` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `res.map_or(5, |a| a + 1)`
error: use Option::map_or instead of an if let/else error: use Option::map_or instead of an if let/else
--> tests/ui/option_if_let_else.rs:258:17 --> tests/ui/option_if_let_else.rs:259:17
| |
LL | let _ = match initial { LL | let _ = match initial {
| _________________^ | _________________^
@ -287,7 +287,7 @@ LL | | };
| |_________^ help: try: `initial.as_ref().map_or(42, |value| do_something(value))` | |_________^ help: try: `initial.as_ref().map_or(42, |value| do_something(value))`
error: use Option::map_or instead of an if let/else error: use Option::map_or instead of an if let/else
--> tests/ui/option_if_let_else.rs:265:17 --> tests/ui/option_if_let_else.rs:266:17
| |
LL | let _ = match initial { LL | let _ = match initial {
| _________________^ | _________________^
@ -297,7 +297,7 @@ LL | | };
| |_________^ help: try: `initial.as_mut().map_or(42, |value| do_something2(value))` | |_________^ help: try: `initial.as_mut().map_or(42, |value| do_something2(value))`
error: use Option::map_or_else instead of an if let/else error: use Option::map_or_else instead of an if let/else
--> tests/ui/option_if_let_else.rs:288:24 --> tests/ui/option_if_let_else.rs:289:24
| |
LL | let mut _hashmap = if let Some(hm) = &opt { LL | let mut _hashmap = if let Some(hm) = &opt {
| ________________________^ | ________________________^
@ -308,7 +308,7 @@ LL | | };
| |_____^ help: try: `opt.as_ref().map_or_else(HashMap::new, |hm| hm.clone())` | |_____^ help: try: `opt.as_ref().map_or_else(HashMap::new, |hm| hm.clone())`
error: use Option::map_or_else instead of an if let/else error: use Option::map_or_else instead of an if let/else
--> tests/ui/option_if_let_else.rs:294:19 --> tests/ui/option_if_let_else.rs:295:19
| |
LL | let mut _hm = if let Some(hm) = &opt { hm.clone() } else { new_map!() }; LL | let mut _hm = if let Some(hm) = &opt { hm.clone() } else { new_map!() };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `opt.as_ref().map_or_else(|| new_map!(), |hm| hm.clone())` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `opt.as_ref().map_or_else(|| new_map!(), |hm| hm.clone())`

View File

@ -1,7 +1,7 @@
//@compile-flags: -Zdeduplicate-diagnostics=yes //@compile-flags: -Zdeduplicate-diagnostics=yes
#![deny(clippy::option_option)] #![deny(clippy::option_option)]
#![allow(clippy::unnecessary_wraps)] #![allow(clippy::unnecessary_wraps, clippy::match_option_and_default)]
const C: Option<Option<i32>> = None; const C: Option<Option<i32>> = None;
//~^ ERROR: consider using `Option<T>` instead of `Option<Option<T>>` or a custom enum if //~^ ERROR: consider using `Option<T>` instead of `Option<Option<T>>` or a custom enum if

View File

@ -6,7 +6,8 @@
clippy::uninlined_format_args, clippy::uninlined_format_args,
clippy::needless_if, clippy::needless_if,
clippy::redundant_guards, clippy::redundant_guards,
clippy::redundant_pattern_matching clippy::redundant_pattern_matching,
clippy::manual_unwrap_or_default
)] )]
fn dummy() {} fn dummy() {}

View File

@ -6,7 +6,8 @@
clippy::uninlined_format_args, clippy::uninlined_format_args,
clippy::needless_if, clippy::needless_if,
clippy::redundant_guards, clippy::redundant_guards,
clippy::redundant_pattern_matching clippy::redundant_pattern_matching,
clippy::manual_unwrap_or_default
)] )]
fn dummy() {} fn dummy() {}

View File

@ -1,5 +1,5 @@
error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let` error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
--> tests/ui/single_match.rs:16:5 --> tests/ui/single_match.rs:17:5
| |
LL | / match x { LL | / match x {
LL | | Some(y) => { LL | | Some(y) => {
@ -19,7 +19,7 @@ LL ~ };
| |
error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let` error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
--> tests/ui/single_match.rs:24:5 --> tests/ui/single_match.rs:25:5
| |
LL | / match x { LL | / match x {
LL | | // Note the missing block braces. LL | | // Note the missing block braces.
@ -31,7 +31,7 @@ LL | | }
| |_____^ help: try: `if let Some(y) = x { println!("{:?}", y) }` | |_____^ help: try: `if let Some(y) = x { println!("{:?}", y) }`
error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let` error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
--> tests/ui/single_match.rs:33:5 --> tests/ui/single_match.rs:34:5
| |
LL | / match z { LL | / match z {
LL | | (2..=3, 7..=9) => dummy(), LL | | (2..=3, 7..=9) => dummy(),
@ -40,7 +40,7 @@ LL | | };
| |_____^ help: try: `if let (2..=3, 7..=9) = z { dummy() }` | |_____^ help: try: `if let (2..=3, 7..=9) = z { dummy() }`
error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let` error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
--> tests/ui/single_match.rs:62:5 --> tests/ui/single_match.rs:63:5
| |
LL | / match x { LL | / match x {
LL | | Some(y) => dummy(), LL | | Some(y) => dummy(),
@ -49,7 +49,7 @@ LL | | };
| |_____^ help: try: `if let Some(y) = x { dummy() }` | |_____^ help: try: `if let Some(y) = x { dummy() }`
error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let` error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
--> tests/ui/single_match.rs:67:5 --> tests/ui/single_match.rs:68:5
| |
LL | / match y { LL | / match y {
LL | | Ok(y) => dummy(), LL | | Ok(y) => dummy(),
@ -58,7 +58,7 @@ LL | | };
| |_____^ help: try: `if let Ok(y) = y { dummy() }` | |_____^ help: try: `if let Ok(y) = y { dummy() }`
error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let` error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
--> tests/ui/single_match.rs:74:5 --> tests/ui/single_match.rs:75:5
| |
LL | / match c { LL | / match c {
LL | | Cow::Borrowed(..) => dummy(), LL | | Cow::Borrowed(..) => dummy(),
@ -67,7 +67,7 @@ LL | | };
| |_____^ help: try: `if let Cow::Borrowed(..) = c { dummy() }` | |_____^ help: try: `if let Cow::Borrowed(..) = c { dummy() }`
error: you seem to be trying to use `match` for an equality check. Consider using `if` error: you seem to be trying to use `match` for an equality check. Consider using `if`
--> tests/ui/single_match.rs:95:5 --> tests/ui/single_match.rs:96:5
| |
LL | / match x { LL | / match x {
LL | | "test" => println!(), LL | | "test" => println!(),
@ -76,7 +76,7 @@ LL | | }
| |_____^ help: try: `if x == "test" { println!() }` | |_____^ help: try: `if x == "test" { println!() }`
error: you seem to be trying to use `match` for an equality check. Consider using `if` error: you seem to be trying to use `match` for an equality check. Consider using `if`
--> tests/ui/single_match.rs:108:5 --> tests/ui/single_match.rs:109:5
| |
LL | / match x { LL | / match x {
LL | | Foo::A => println!(), LL | | Foo::A => println!(),
@ -85,7 +85,7 @@ LL | | }
| |_____^ help: try: `if x == Foo::A { println!() }` | |_____^ help: try: `if x == Foo::A { println!() }`
error: you seem to be trying to use `match` for an equality check. Consider using `if` error: you seem to be trying to use `match` for an equality check. Consider using `if`
--> tests/ui/single_match.rs:114:5 --> tests/ui/single_match.rs:115:5
| |
LL | / match x { LL | / match x {
LL | | FOO_C => println!(), LL | | FOO_C => println!(),
@ -94,7 +94,7 @@ LL | | }
| |_____^ help: try: `if x == FOO_C { println!() }` | |_____^ help: try: `if x == FOO_C { println!() }`
error: you seem to be trying to use `match` for an equality check. Consider using `if` error: you seem to be trying to use `match` for an equality check. Consider using `if`
--> tests/ui/single_match.rs:119:5 --> tests/ui/single_match.rs:120:5
| |
LL | / match &&x { LL | / match &&x {
LL | | Foo::A => println!(), LL | | Foo::A => println!(),
@ -103,7 +103,7 @@ LL | | }
| |_____^ help: try: `if x == Foo::A { println!() }` | |_____^ help: try: `if x == Foo::A { println!() }`
error: you seem to be trying to use `match` for an equality check. Consider using `if` error: you seem to be trying to use `match` for an equality check. Consider using `if`
--> tests/ui/single_match.rs:125:5 --> tests/ui/single_match.rs:126:5
| |
LL | / match &x { LL | / match &x {
LL | | Foo::A => println!(), LL | | Foo::A => println!(),
@ -112,7 +112,7 @@ LL | | }
| |_____^ help: try: `if x == &Foo::A { println!() }` | |_____^ help: try: `if x == &Foo::A { println!() }`
error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let` error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
--> tests/ui/single_match.rs:142:5 --> tests/ui/single_match.rs:143:5
| |
LL | / match x { LL | / match x {
LL | | Bar::A => println!(), LL | | Bar::A => println!(),
@ -121,7 +121,7 @@ LL | | }
| |_____^ help: try: `if let Bar::A = x { println!() }` | |_____^ help: try: `if let Bar::A = x { println!() }`
error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let` error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
--> tests/ui/single_match.rs:150:5 --> tests/ui/single_match.rs:151:5
| |
LL | / match x { LL | / match x {
LL | | None => println!(), LL | | None => println!(),
@ -130,7 +130,7 @@ LL | | };
| |_____^ help: try: `if let None = x { println!() }` | |_____^ help: try: `if let None = x { println!() }`
error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let` error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
--> tests/ui/single_match.rs:172:5 --> tests/ui/single_match.rs:173:5
| |
LL | / match x { LL | / match x {
LL | | (Some(_), _) => {}, LL | | (Some(_), _) => {},
@ -139,7 +139,7 @@ LL | | }
| |_____^ help: try: `if let (Some(_), _) = x {}` | |_____^ help: try: `if let (Some(_), _) = x {}`
error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let` error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
--> tests/ui/single_match.rs:178:5 --> tests/ui/single_match.rs:179:5
| |
LL | / match x { LL | / match x {
LL | | (Some(E::V), _) => todo!(), LL | | (Some(E::V), _) => todo!(),
@ -148,7 +148,7 @@ LL | | }
| |_____^ help: try: `if let (Some(E::V), _) = x { todo!() }` | |_____^ help: try: `if let (Some(E::V), _) = x { todo!() }`
error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let` error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
--> tests/ui/single_match.rs:184:5 --> tests/ui/single_match.rs:185:5
| |
LL | / match (Some(42), Some(E::V), Some(42)) { LL | / match (Some(42), Some(E::V), Some(42)) {
LL | | (.., Some(E::V), _) => {}, LL | | (.., Some(E::V), _) => {},
@ -157,7 +157,7 @@ LL | | }
| |_____^ help: try: `if let (.., Some(E::V), _) = (Some(42), Some(E::V), Some(42)) {}` | |_____^ help: try: `if let (.., Some(E::V), _) = (Some(42), Some(E::V), Some(42)) {}`
error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let` error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
--> tests/ui/single_match.rs:256:5 --> tests/ui/single_match.rs:257:5
| |
LL | / match bar { LL | / match bar {
LL | | Some(v) => unsafe { LL | | Some(v) => unsafe {
@ -177,7 +177,7 @@ LL + } }
| |
error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let` error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
--> tests/ui/single_match.rs:264:5 --> tests/ui/single_match.rs:265:5
| |
LL | / match bar { LL | / match bar {
LL | | #[rustfmt::skip] LL | | #[rustfmt::skip]