rust-clippy/tests/ui/single_match.stderr
2018-10-27 15:47:56 +02:00

61 lines
2.1 KiB
Text

error: you seem to be trying to use match for destructuring a single pattern. Consider using `if let`
--> $DIR/single_match.rs:21:5
|
21 | / match x {
22 | | Some(y) => { println!("{:?}", y); }
23 | | _ => ()
24 | | };
| |_____^ help: try this: `if let Some(y) = x { println!("{:?}", y); }`
|
= note: `-D clippy::single-match` implied by `-D warnings`
error: you seem to be trying to use match for destructuring a single pattern. Consider using `if let`
--> $DIR/single_match.rs:27:5
|
27 | / match x {
28 | | // Note the missing block braces.
29 | | // We suggest `if let Some(y) = x { .. }` because the macro
30 | | // is expanded before we can do anything.
31 | | Some(y) => println!("{:?}", y),
32 | | _ => ()
33 | | }
| |_____^ help: try this: `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`
--> $DIR/single_match.rs:36:5
|
36 | / match z {
37 | | (2...3, 7...9) => dummy(),
38 | | _ => {}
39 | | };
| |_____^ help: try this: `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`
--> $DIR/single_match.rs:62:5
|
62 | / match x {
63 | | Some(y) => dummy(),
64 | | None => ()
65 | | };
| |_____^ help: try this: `if let Some(y) = x { dummy() }`
error: you seem to be trying to use match for destructuring a single pattern. Consider using `if let`
--> $DIR/single_match.rs:67:5
|
67 | / match y {
68 | | Ok(y) => dummy(),
69 | | Err(..) => ()
70 | | };
| |_____^ help: try this: `if let Ok(y) = y { dummy() }`
error: you seem to be trying to use match for destructuring a single pattern. Consider using `if let`
--> $DIR/single_match.rs:74:5
|
74 | / match c {
75 | | Cow::Borrowed(..) => dummy(),
76 | | Cow::Owned(..) => (),
77 | | };
| |_____^ help: try this: `if let Cow::Borrowed(..) = c { dummy() }`
error: aborting due to 6 previous errors