rust-clippy/tests/ui/single_match.stderr

70 lines
2.2 KiB
Text
Raw Normal View History

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