2021-01-30 11:06:34 -06:00
|
|
|
error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
|
2024-03-08 15:04:17 -06:00
|
|
|
--> tests/ui/single_match.rs:17:5
|
2018-04-05 14:18:38 -05:00
|
|
|
|
|
2018-12-27 09:57:55 -06:00
|
|
|
LL | / match x {
|
|
|
|
LL | | Some(y) => {
|
|
|
|
LL | | println!("{:?}", y);
|
|
|
|
LL | | },
|
|
|
|
LL | | _ => (),
|
|
|
|
LL | | };
|
2018-12-09 23:27:19 -06:00
|
|
|
| |_____^
|
2018-04-05 14:18:38 -05:00
|
|
|
|
|
2018-08-01 09:30:44 -05:00
|
|
|
= note: `-D clippy::single-match` implied by `-D warnings`
|
2023-08-01 07:02:21 -05:00
|
|
|
= help: to override `-D warnings` add `#[allow(clippy::single_match)]`
|
2023-07-17 03:19:29 -05:00
|
|
|
help: try
|
2018-12-09 23:27:19 -06:00
|
|
|
|
|
2021-08-11 09:21:33 -05:00
|
|
|
LL ~ if let Some(y) = x {
|
|
|
|
LL + println!("{:?}", y);
|
|
|
|
LL ~ };
|
2018-12-09 23:27:19 -06:00
|
|
|
|
|
2018-04-05 14:18:38 -05:00
|
|
|
|
2021-01-30 11:06:34 -06:00
|
|
|
error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
|
2024-03-08 15:04:17 -06:00
|
|
|
--> tests/ui/single_match.rs:25:5
|
2018-12-09 23:27:19 -06:00
|
|
|
|
|
2018-12-27 09:57:55 -06:00
|
|
|
LL | / match x {
|
|
|
|
LL | | // Note the missing block braces.
|
|
|
|
LL | | // We suggest `if let Some(y) = x { .. }` because the macro
|
|
|
|
LL | | // is expanded before we can do anything.
|
|
|
|
LL | | Some(y) => println!("{:?}", y),
|
|
|
|
LL | | _ => (),
|
|
|
|
LL | | }
|
2023-07-17 03:19:29 -05:00
|
|
|
| |_____^ help: try: `if let Some(y) = x { println!("{:?}", y) }`
|
2018-10-27 07:45:02 -05:00
|
|
|
|
2021-01-30 11:06:34 -06:00
|
|
|
error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
|
2024-03-08 15:04:17 -06:00
|
|
|
--> tests/ui/single_match.rs:34:5
|
2018-10-27 07:45:02 -05:00
|
|
|
|
|
2018-12-27 09:57:55 -06:00
|
|
|
LL | / match z {
|
2019-06-01 00:54:47 -05:00
|
|
|
LL | | (2..=3, 7..=9) => dummy(),
|
2018-12-27 09:57:55 -06:00
|
|
|
LL | | _ => {},
|
|
|
|
LL | | };
|
2023-07-17 03:19:29 -05:00
|
|
|
| |_____^ help: try: `if let (2..=3, 7..=9) = z { dummy() }`
|
2018-04-05 14:18:38 -05:00
|
|
|
|
2022-06-30 03:50:09 -05:00
|
|
|
error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
|
2024-03-08 15:04:17 -06:00
|
|
|
--> tests/ui/single_match.rs:63:5
|
2022-06-30 03:50:09 -05:00
|
|
|
|
|
|
|
|
LL | / match x {
|
|
|
|
LL | | Some(y) => dummy(),
|
|
|
|
LL | | None => (),
|
|
|
|
LL | | };
|
2023-07-17 03:19:29 -05:00
|
|
|
| |_____^ help: try: `if let Some(y) = x { dummy() }`
|
2022-06-30 03:50:09 -05:00
|
|
|
|
2021-01-30 11:06:34 -06:00
|
|
|
error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
|
2024-03-08 15:04:17 -06:00
|
|
|
--> tests/ui/single_match.rs:68:5
|
2018-04-05 14:18:38 -05:00
|
|
|
|
|
2018-12-27 09:57:55 -06:00
|
|
|
LL | / match y {
|
|
|
|
LL | | Ok(y) => dummy(),
|
|
|
|
LL | | Err(..) => (),
|
|
|
|
LL | | };
|
2023-07-17 03:19:29 -05:00
|
|
|
| |_____^ help: try: `if let Ok(y) = y { dummy() }`
|
2018-04-05 14:18:38 -05:00
|
|
|
|
2021-01-30 11:06:34 -06:00
|
|
|
error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
|
2024-03-08 15:04:17 -06:00
|
|
|
--> tests/ui/single_match.rs:75:5
|
2018-04-05 14:18:38 -05:00
|
|
|
|
|
2018-12-27 09:57:55 -06:00
|
|
|
LL | / match c {
|
|
|
|
LL | | Cow::Borrowed(..) => dummy(),
|
|
|
|
LL | | Cow::Owned(..) => (),
|
|
|
|
LL | | };
|
2023-07-17 03:19:29 -05:00
|
|
|
| |_____^ help: try: `if let Cow::Borrowed(..) = c { dummy() }`
|
2018-04-05 14:18:38 -05:00
|
|
|
|
2021-01-30 11:06:34 -06:00
|
|
|
error: you seem to be trying to use `match` for an equality check. Consider using `if`
|
2024-03-08 15:04:17 -06:00
|
|
|
--> tests/ui/single_match.rs:96:5
|
2021-01-30 11:06:34 -06:00
|
|
|
|
|
|
|
|
LL | / match x {
|
|
|
|
LL | | "test" => println!(),
|
|
|
|
LL | | _ => (),
|
|
|
|
LL | | }
|
2023-07-17 03:19:29 -05:00
|
|
|
| |_____^ help: try: `if x == "test" { println!() }`
|
2021-01-30 11:06:34 -06:00
|
|
|
|
|
|
|
error: you seem to be trying to use `match` for an equality check. Consider using `if`
|
2024-03-08 15:04:17 -06:00
|
|
|
--> tests/ui/single_match.rs:109:5
|
2021-01-30 11:06:34 -06:00
|
|
|
|
|
|
|
|
LL | / match x {
|
|
|
|
LL | | Foo::A => println!(),
|
|
|
|
LL | | _ => (),
|
|
|
|
LL | | }
|
2023-07-17 03:19:29 -05:00
|
|
|
| |_____^ help: try: `if x == Foo::A { println!() }`
|
2021-01-30 11:06:34 -06:00
|
|
|
|
|
|
|
error: you seem to be trying to use `match` for an equality check. Consider using `if`
|
2024-03-08 15:04:17 -06:00
|
|
|
--> tests/ui/single_match.rs:115:5
|
2021-01-30 11:06:34 -06:00
|
|
|
|
|
|
|
|
LL | / match x {
|
|
|
|
LL | | FOO_C => println!(),
|
|
|
|
LL | | _ => (),
|
|
|
|
LL | | }
|
2023-07-17 03:19:29 -05:00
|
|
|
| |_____^ help: try: `if x == FOO_C { println!() }`
|
2021-01-30 11:06:34 -06:00
|
|
|
|
|
|
|
error: you seem to be trying to use `match` for an equality check. Consider using `if`
|
2024-03-08 15:04:17 -06:00
|
|
|
--> tests/ui/single_match.rs:120:5
|
2021-01-30 11:06:34 -06:00
|
|
|
|
|
|
|
|
LL | / match &&x {
|
|
|
|
LL | | Foo::A => println!(),
|
|
|
|
LL | | _ => (),
|
|
|
|
LL | | }
|
2023-07-17 03:19:29 -05:00
|
|
|
| |_____^ help: try: `if x == Foo::A { println!() }`
|
2021-01-30 11:06:34 -06:00
|
|
|
|
|
|
|
error: you seem to be trying to use `match` for an equality check. Consider using `if`
|
2024-03-08 15:04:17 -06:00
|
|
|
--> tests/ui/single_match.rs:126:5
|
2021-01-30 11:06:34 -06:00
|
|
|
|
|
|
|
|
LL | / match &x {
|
|
|
|
LL | | Foo::A => println!(),
|
|
|
|
LL | | _ => (),
|
|
|
|
LL | | }
|
2023-07-17 03:19:29 -05:00
|
|
|
| |_____^ help: try: `if x == &Foo::A { println!() }`
|
2021-01-30 11:06:34 -06:00
|
|
|
|
|
|
|
error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
|
2024-03-08 15:04:17 -06:00
|
|
|
--> tests/ui/single_match.rs:143:5
|
2021-01-30 11:06:34 -06:00
|
|
|
|
|
|
|
|
LL | / match x {
|
|
|
|
LL | | Bar::A => println!(),
|
|
|
|
LL | | _ => (),
|
|
|
|
LL | | }
|
2023-07-17 03:19:29 -05:00
|
|
|
| |_____^ help: try: `if let Bar::A = x { println!() }`
|
2021-01-30 11:06:34 -06:00
|
|
|
|
2021-04-22 04:31:13 -05:00
|
|
|
error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
|
2024-03-08 15:04:17 -06:00
|
|
|
--> tests/ui/single_match.rs:151:5
|
2021-04-22 04:31:13 -05:00
|
|
|
|
|
|
|
|
LL | / match x {
|
|
|
|
LL | | None => println!(),
|
|
|
|
LL | | _ => (),
|
|
|
|
LL | | };
|
2023-07-17 03:19:29 -05:00
|
|
|
| |_____^ help: try: `if let None = x { println!() }`
|
2021-04-22 04:31:13 -05:00
|
|
|
|
2022-02-10 11:40:06 -06:00
|
|
|
error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
|
2024-03-08 15:04:17 -06:00
|
|
|
--> tests/ui/single_match.rs:173:5
|
2022-02-10 11:40:06 -06:00
|
|
|
|
|
|
|
|
LL | / match x {
|
|
|
|
LL | | (Some(_), _) => {},
|
|
|
|
LL | | (None, _) => {},
|
|
|
|
LL | | }
|
2023-07-17 03:19:29 -05:00
|
|
|
| |_____^ help: try: `if let (Some(_), _) = x {}`
|
2022-02-10 11:40:06 -06:00
|
|
|
|
|
|
|
error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
|
2024-03-08 15:04:17 -06:00
|
|
|
--> tests/ui/single_match.rs:179:5
|
2022-02-10 11:40:06 -06:00
|
|
|
|
|
|
|
|
LL | / match x {
|
|
|
|
LL | | (Some(E::V), _) => todo!(),
|
|
|
|
LL | | (_, _) => {},
|
|
|
|
LL | | }
|
2023-07-17 03:19:29 -05:00
|
|
|
| |_____^ help: try: `if let (Some(E::V), _) = x { todo!() }`
|
2022-02-10 11:40:06 -06:00
|
|
|
|
|
|
|
error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
|
2024-03-08 15:04:17 -06:00
|
|
|
--> tests/ui/single_match.rs:185:5
|
2022-02-10 11:40:06 -06:00
|
|
|
|
|
|
|
|
LL | / match (Some(42), Some(E::V), Some(42)) {
|
|
|
|
LL | | (.., Some(E::V), _) => {},
|
|
|
|
LL | | (..) => {},
|
|
|
|
LL | | }
|
2023-07-17 03:19:29 -05:00
|
|
|
| |_____^ help: try: `if let (.., Some(E::V), _) = (Some(42), Some(E::V), Some(42)) {}`
|
2022-02-10 11:40:06 -06:00
|
|
|
|
2023-06-02 04:41:57 -05:00
|
|
|
error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
|
2024-03-08 15:04:17 -06:00
|
|
|
--> tests/ui/single_match.rs:257:5
|
2023-06-02 04:41:57 -05:00
|
|
|
|
|
|
|
|
LL | / match bar {
|
|
|
|
LL | | Some(v) => unsafe {
|
|
|
|
LL | | let r = &v as *const i32;
|
|
|
|
LL | | println!("{}", *r);
|
|
|
|
LL | | },
|
|
|
|
LL | | _ => {},
|
|
|
|
LL | | }
|
|
|
|
| |_____^
|
|
|
|
|
|
2023-07-17 03:19:29 -05:00
|
|
|
help: try
|
2023-06-02 04:41:57 -05:00
|
|
|
|
|
|
|
|
LL ~ if let Some(v) = bar { unsafe {
|
|
|
|
LL + let r = &v as *const i32;
|
|
|
|
LL + println!("{}", *r);
|
|
|
|
LL + } }
|
|
|
|
|
|
|
|
|
|
|
|
|
error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
|
2024-03-08 15:04:17 -06:00
|
|
|
--> tests/ui/single_match.rs:265:5
|
2023-06-02 04:41:57 -05:00
|
|
|
|
|
|
|
|
LL | / match bar {
|
|
|
|
LL | | #[rustfmt::skip]
|
|
|
|
LL | | Some(v) => {
|
|
|
|
LL | | unsafe {
|
|
|
|
... |
|
|
|
|
LL | | _ => {},
|
|
|
|
LL | | }
|
|
|
|
| |_____^
|
|
|
|
|
|
2023-07-17 03:19:29 -05:00
|
|
|
help: try
|
2023-06-02 04:41:57 -05:00
|
|
|
|
|
|
|
|
LL ~ if let Some(v) = bar {
|
|
|
|
LL + unsafe {
|
|
|
|
LL + let r = &v as *const i32;
|
|
|
|
LL + println!("{}", *r);
|
|
|
|
LL + }
|
|
|
|
LL + }
|
|
|
|
|
|
|
|
|
|
|
|
|
error: aborting due to 18 previous errors
|
2018-04-05 14:18:38 -05:00
|
|
|
|