]> git.lizzy.rs Git - rust.git/blobdiff - tests/ui/single_match.stderr
iterate List by value
[rust.git] / tests / ui / single_match.stderr
index 20d8fed25fd28055c914233e7bc1d1ad7e1a0920..f69554d75f9bf7aa1f08f4e0bfb3fc3d5d4bb89a 100644 (file)
@@ -1,49 +1,69 @@
 error: you seem to be trying to use match for destructuring a single pattern. Consider using `if let`
-  --> $DIR/single_match.rs:11:5
+  --> $DIR/single_match.rs:8:5
    |
-11 | /     match x {
-12 | |         Some(y) => { println!("{:?}", y); }
-13 | |         _ => ()
-14 | |     };
-   | |_____^ help: try this: `if let Some(y) = x { println!("{:?}", y); }`
+LL | /     match x {
+LL | |         Some(y) => {
+LL | |             println!("{:?}", y);
+LL | |         },
+LL | |         _ => (),
+LL | |     };
+   | |_____^
    |
    = note: `-D clippy::single-match` implied by `-D warnings`
+help: try this
+   |
+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`
+  --> $DIR/single_match.rs:16: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 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:17:5
+  --> $DIR/single_match.rs:25:5
    |
-17 | /     match z {
-18 | |         (2...3, 7...9) => dummy(),
-19 | |         _ => {}
-20 | |     };
-   | |_____^ help: try this: `if let (2...3, 7...9) = z { dummy() }`
+LL | /     match z {
+LL | |         (2..=3, 7..=9) => dummy(),
+LL | |         _ => {},
+LL | |     };
+   | |_____^ 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
+  --> $DIR/single_match.rs:54:5
    |
-43 | /     match x {
-44 | |         Some(y) => dummy(),
-45 | |         None => ()
-46 | |     };
+LL | /     match x {
+LL | |         Some(y) => dummy(),
+LL | |         None => (),
+LL | |     };
    | |_____^ 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
+  --> $DIR/single_match.rs:59:5
    |
-48 | /     match y {
-49 | |         Ok(y) => dummy(),
-50 | |         Err(..) => ()
-51 | |     };
+LL | /     match y {
+LL | |         Ok(y) => dummy(),
+LL | |         Err(..) => (),
+LL | |     };
    | |_____^ 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
+  --> $DIR/single_match.rs:66:5
    |
-55 | /     match c {
-56 | |         Cow::Borrowed(..) => dummy(),
-57 | |         Cow::Owned(..) => (),
-58 | |     };
+LL | /     match c {
+LL | |         Cow::Borrowed(..) => dummy(),
+LL | |         Cow::Owned(..) => (),
+LL | |     };
    | |_____^ help: try this: `if let Cow::Borrowed(..) = c { dummy() }`
 
-error: aborting due to 5 previous errors
+error: aborting due to 6 previous errors