2021-01-30 17:06:34 +00:00
|
|
|
error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
|
2019-01-07 21:33:18 +00:00
|
|
|
--> $DIR/single_match.rs:8:5
|
2018-04-05 19:18:38 +00:00
|
|
|
|
|
2018-12-27 15:57:55 +00:00
|
|
|
LL | / match x {
|
|
|
|
LL | | Some(y) => {
|
|
|
|
LL | | println!("{:?}", y);
|
|
|
|
LL | | },
|
|
|
|
LL | | _ => (),
|
|
|
|
LL | | };
|
2018-12-10 05:27:19 +00:00
|
|
|
| |_____^
|
2018-04-05 19:18:38 +00:00
|
|
|
|
|
2018-08-01 14:30:44 +00:00
|
|
|
= note: `-D clippy::single-match` implied by `-D warnings`
|
2018-12-10 05:27:19 +00:00
|
|
|
help: try this
|
|
|
|
|
|
2021-08-11 14:21:33 +00:00
|
|
|
LL ~ if let Some(y) = x {
|
|
|
|
LL + println!("{:?}", y);
|
|
|
|
LL ~ };
|
2018-12-10 05:27:19 +00:00
|
|
|
|
|
2018-04-05 19:18:38 +00:00
|
|
|
|
2021-01-30 17:06:34 +00:00
|
|
|
error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
|
2019-01-07 21:33:18 +00:00
|
|
|
--> $DIR/single_match.rs:16:5
|
2018-12-10 05:27:19 +00:00
|
|
|
|
|
2018-12-27 15:57:55 +00: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 | | }
|
2018-10-27 12:45:02 +00:00
|
|
|
| |_____^ help: try this: `if let Some(y) = x { println!("{:?}", y) }`
|
|
|
|
|
2021-01-30 17:06:34 +00:00
|
|
|
error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
|
2019-01-07 21:33:18 +00:00
|
|
|
--> $DIR/single_match.rs:25:5
|
2018-10-27 12:45:02 +00:00
|
|
|
|
|
2018-12-27 15:57:55 +00:00
|
|
|
LL | / match z {
|
2019-06-01 05:54:47 +00:00
|
|
|
LL | | (2..=3, 7..=9) => dummy(),
|
2018-12-27 15:57:55 +00:00
|
|
|
LL | | _ => {},
|
|
|
|
LL | | };
|
2019-06-01 05:54:47 +00:00
|
|
|
| |_____^ help: try this: `if let (2..=3, 7..=9) = z { dummy() }`
|
2018-04-05 19:18:38 +00:00
|
|
|
|
2021-01-30 17:06:34 +00:00
|
|
|
error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
|
2019-01-07 21:33:18 +00:00
|
|
|
--> $DIR/single_match.rs:59:5
|
2018-04-05 19:18:38 +00:00
|
|
|
|
|
2018-12-27 15:57:55 +00:00
|
|
|
LL | / match y {
|
|
|
|
LL | | Ok(y) => dummy(),
|
|
|
|
LL | | Err(..) => (),
|
|
|
|
LL | | };
|
2018-04-05 19:18:38 +00:00
|
|
|
| |_____^ help: try this: `if let Ok(y) = y { dummy() }`
|
|
|
|
|
2021-01-30 17:06:34 +00:00
|
|
|
error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
|
2019-01-07 21:33:18 +00:00
|
|
|
--> $DIR/single_match.rs:66:5
|
2018-04-05 19:18:38 +00:00
|
|
|
|
|
2018-12-27 15:57:55 +00:00
|
|
|
LL | / match c {
|
|
|
|
LL | | Cow::Borrowed(..) => dummy(),
|
|
|
|
LL | | Cow::Owned(..) => (),
|
|
|
|
LL | | };
|
2018-04-05 19:18:38 +00:00
|
|
|
| |_____^ help: try this: `if let Cow::Borrowed(..) = c { dummy() }`
|
|
|
|
|
2021-01-30 17:06:34 +00:00
|
|
|
error: you seem to be trying to use `match` for an equality check. Consider using `if`
|
|
|
|
--> $DIR/single_match.rs:87:5
|
|
|
|
|
|
|
|
|
LL | / match x {
|
|
|
|
LL | | "test" => println!(),
|
|
|
|
LL | | _ => (),
|
|
|
|
LL | | }
|
|
|
|
| |_____^ help: try this: `if x == "test" { println!() }`
|
|
|
|
|
|
|
|
error: you seem to be trying to use `match` for an equality check. Consider using `if`
|
|
|
|
--> $DIR/single_match.rs:100:5
|
|
|
|
|
|
|
|
|
LL | / match x {
|
|
|
|
LL | | Foo::A => println!(),
|
|
|
|
LL | | _ => (),
|
|
|
|
LL | | }
|
|
|
|
| |_____^ help: try this: `if x == Foo::A { println!() }`
|
|
|
|
|
|
|
|
error: you seem to be trying to use `match` for an equality check. Consider using `if`
|
|
|
|
--> $DIR/single_match.rs:106:5
|
|
|
|
|
|
|
|
|
LL | / match x {
|
|
|
|
LL | | FOO_C => println!(),
|
|
|
|
LL | | _ => (),
|
|
|
|
LL | | }
|
|
|
|
| |_____^ help: try this: `if x == FOO_C { println!() }`
|
|
|
|
|
|
|
|
error: you seem to be trying to use `match` for an equality check. Consider using `if`
|
|
|
|
--> $DIR/single_match.rs:111:5
|
|
|
|
|
|
|
|
|
LL | / match &&x {
|
|
|
|
LL | | Foo::A => println!(),
|
|
|
|
LL | | _ => (),
|
|
|
|
LL | | }
|
|
|
|
| |_____^ help: try this: `if x == Foo::A { println!() }`
|
|
|
|
|
|
|
|
error: you seem to be trying to use `match` for an equality check. Consider using `if`
|
|
|
|
--> $DIR/single_match.rs:117:5
|
|
|
|
|
|
|
|
|
LL | / match &x {
|
|
|
|
LL | | Foo::A => println!(),
|
|
|
|
LL | | _ => (),
|
|
|
|
LL | | }
|
|
|
|
| |_____^ help: try this: `if x == &Foo::A { println!() }`
|
|
|
|
|
|
|
|
error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
|
|
|
|
--> $DIR/single_match.rs:134:5
|
|
|
|
|
|
|
|
|
LL | / match x {
|
|
|
|
LL | | Bar::A => println!(),
|
|
|
|
LL | | _ => (),
|
|
|
|
LL | | }
|
|
|
|
| |_____^ help: try this: `if let Bar::A = x { println!() }`
|
|
|
|
|
2021-04-22 09:31:13 +00:00
|
|
|
error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
|
|
|
|
--> $DIR/single_match.rs:142:5
|
|
|
|
|
|
|
|
|
LL | / match x {
|
|
|
|
LL | | None => println!(),
|
|
|
|
LL | | _ => (),
|
|
|
|
LL | | };
|
|
|
|
| |_____^ help: try this: `if let None = x { println!() }`
|
|
|
|
|
2022-02-10 17:40:06 +00:00
|
|
|
error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
|
|
|
|
--> $DIR/single_match.rs:164:5
|
|
|
|
|
|
|
|
|
LL | / match x {
|
|
|
|
LL | | (Some(_), _) => {},
|
|
|
|
LL | | (None, _) => {},
|
|
|
|
LL | | }
|
|
|
|
| |_____^ help: try this: `if let (Some(_), _) = x {}`
|
|
|
|
|
|
|
|
error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
|
|
|
|
--> $DIR/single_match.rs:170:5
|
|
|
|
|
|
|
|
|
LL | / match x {
|
|
|
|
LL | | (Some(E::V), _) => todo!(),
|
|
|
|
LL | | (_, _) => {},
|
|
|
|
LL | | }
|
|
|
|
| |_____^ help: try this: `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`
|
|
|
|
--> $DIR/single_match.rs:176:5
|
|
|
|
|
|
|
|
|
LL | / match (Some(42), Some(E::V), Some(42)) {
|
|
|
|
LL | | (.., Some(E::V), _) => {},
|
|
|
|
LL | | (..) => {},
|
|
|
|
LL | | }
|
|
|
|
| |_____^ help: try this: `if let (.., Some(E::V), _) = (Some(42), Some(E::V), Some(42)) {}`
|
|
|
|
|
|
|
|
error: aborting due to 15 previous errors
|
2018-04-05 19:18:38 +00:00
|
|
|
|