203 lines
6.2 KiB
Plaintext
203 lines
6.2 KiB
Plaintext
error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
|
|
--> tests/ui/single_match.rs:17:5
|
|
|
|
|
LL | / match x {
|
|
LL | | Some(y) => {
|
|
LL | | println!("{:?}", y);
|
|
LL | | },
|
|
LL | | _ => (),
|
|
LL | | };
|
|
| |_____^
|
|
|
|
|
= note: `-D clippy::single-match` implied by `-D warnings`
|
|
= help: to override `-D warnings` add `#[allow(clippy::single_match)]`
|
|
help: try
|
|
|
|
|
LL ~ if let Some(y) = x {
|
|
LL + println!("{:?}", y);
|
|
LL ~ };
|
|
|
|
|
|
|
error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
|
|
--> tests/ui/single_match.rs:25:5
|
|
|
|
|
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 | | }
|
|
| |_____^ 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`
|
|
--> tests/ui/single_match.rs:34:5
|
|
|
|
|
LL | / match z {
|
|
LL | | (2..=3, 7..=9) => dummy(),
|
|
LL | | _ => {},
|
|
LL | | };
|
|
| |_____^ 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`
|
|
--> tests/ui/single_match.rs:63:5
|
|
|
|
|
LL | / match x {
|
|
LL | | Some(y) => dummy(),
|
|
LL | | None => (),
|
|
LL | | };
|
|
| |_____^ 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`
|
|
--> tests/ui/single_match.rs:68:5
|
|
|
|
|
LL | / match y {
|
|
LL | | Ok(y) => dummy(),
|
|
LL | | Err(..) => (),
|
|
LL | | };
|
|
| |_____^ 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`
|
|
--> tests/ui/single_match.rs:75:5
|
|
|
|
|
LL | / match c {
|
|
LL | | Cow::Borrowed(..) => dummy(),
|
|
LL | | Cow::Owned(..) => (),
|
|
LL | | };
|
|
| |_____^ help: try: `if let Cow::Borrowed(..) = c { dummy() }`
|
|
|
|
error: you seem to be trying to use `match` for an equality check. Consider using `if`
|
|
--> tests/ui/single_match.rs:96:5
|
|
|
|
|
LL | / match x {
|
|
LL | | "test" => println!(),
|
|
LL | | _ => (),
|
|
LL | | }
|
|
| |_____^ help: try: `if x == "test" { println!() }`
|
|
|
|
error: you seem to be trying to use `match` for an equality check. Consider using `if`
|
|
--> tests/ui/single_match.rs:109:5
|
|
|
|
|
LL | / match x {
|
|
LL | | Foo::A => println!(),
|
|
LL | | _ => (),
|
|
LL | | }
|
|
| |_____^ help: try: `if x == Foo::A { println!() }`
|
|
|
|
error: you seem to be trying to use `match` for an equality check. Consider using `if`
|
|
--> tests/ui/single_match.rs:115:5
|
|
|
|
|
LL | / match x {
|
|
LL | | FOO_C => println!(),
|
|
LL | | _ => (),
|
|
LL | | }
|
|
| |_____^ help: try: `if x == FOO_C { println!() }`
|
|
|
|
error: you seem to be trying to use `match` for an equality check. Consider using `if`
|
|
--> tests/ui/single_match.rs:120:5
|
|
|
|
|
LL | / match &&x {
|
|
LL | | Foo::A => println!(),
|
|
LL | | _ => (),
|
|
LL | | }
|
|
| |_____^ help: try: `if x == Foo::A { println!() }`
|
|
|
|
error: you seem to be trying to use `match` for an equality check. Consider using `if`
|
|
--> tests/ui/single_match.rs:126:5
|
|
|
|
|
LL | / match &x {
|
|
LL | | Foo::A => println!(),
|
|
LL | | _ => (),
|
|
LL | | }
|
|
| |_____^ 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`
|
|
--> tests/ui/single_match.rs:143:5
|
|
|
|
|
LL | / match x {
|
|
LL | | Bar::A => println!(),
|
|
LL | | _ => (),
|
|
LL | | }
|
|
| |_____^ 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`
|
|
--> tests/ui/single_match.rs:151:5
|
|
|
|
|
LL | / match x {
|
|
LL | | None => println!(),
|
|
LL | | _ => (),
|
|
LL | | };
|
|
| |_____^ 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`
|
|
--> tests/ui/single_match.rs:173:5
|
|
|
|
|
LL | / match x {
|
|
LL | | (Some(_), _) => {},
|
|
LL | | (None, _) => {},
|
|
LL | | }
|
|
| |_____^ help: try: `if let (Some(_), _) = x {}`
|
|
|
|
error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
|
|
--> tests/ui/single_match.rs:179:5
|
|
|
|
|
LL | / match x {
|
|
LL | | (Some(E::V), _) => todo!(),
|
|
LL | | (_, _) => {},
|
|
LL | | }
|
|
| |_____^ 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`
|
|
--> tests/ui/single_match.rs:185:5
|
|
|
|
|
LL | / match (Some(42), Some(E::V), Some(42)) {
|
|
LL | | (.., Some(E::V), _) => {},
|
|
LL | | (..) => {},
|
|
LL | | }
|
|
| |_____^ 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`
|
|
--> tests/ui/single_match.rs:257:5
|
|
|
|
|
LL | / match bar {
|
|
LL | | Some(v) => unsafe {
|
|
LL | | let r = &v as *const i32;
|
|
LL | | println!("{}", *r);
|
|
LL | | },
|
|
LL | | _ => {},
|
|
LL | | }
|
|
| |_____^
|
|
|
|
|
help: try
|
|
|
|
|
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`
|
|
--> tests/ui/single_match.rs:265:5
|
|
|
|
|
LL | / match bar {
|
|
LL | | #[rustfmt::skip]
|
|
LL | | Some(v) => {
|
|
LL | | unsafe {
|
|
... |
|
|
LL | | _ => {},
|
|
LL | | }
|
|
| |_____^
|
|
|
|
|
help: try
|
|
|
|
|
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
|
|
|