mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-14 17:07:17 +00:00
49 lines
1.6 KiB
Text
49 lines
1.6 KiB
Text
error: you seem to be trying to use match for destructuring a single pattern. Consider using `if let`
|
|
--> $DIR/single_match.rs:11:5
|
|
|
|
|
11 | / match x {
|
|
12 | | Some(y) => { println!("{:?}", y); }
|
|
13 | | _ => ()
|
|
14 | | };
|
|
| |_____^ 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:17:5
|
|
|
|
|
17 | / match z {
|
|
18 | | (2...3, 7...9) => dummy(),
|
|
19 | | _ => {}
|
|
20 | | };
|
|
| |_____^ 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:43:5
|
|
|
|
|
43 | / match x {
|
|
44 | | Some(y) => dummy(),
|
|
45 | | None => ()
|
|
46 | | };
|
|
| |_____^ 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:48:5
|
|
|
|
|
48 | / match y {
|
|
49 | | Ok(y) => dummy(),
|
|
50 | | Err(..) => ()
|
|
51 | | };
|
|
| |_____^ 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:55:5
|
|
|
|
|
55 | / match c {
|
|
56 | | Cow::Borrowed(..) => dummy(),
|
|
57 | | Cow::Owned(..) => (),
|
|
58 | | };
|
|
| |_____^ help: try this: `if let Cow::Borrowed(..) = c { dummy() }`
|
|
|
|
error: aborting due to 5 previous errors
|
|
|