]> git.lizzy.rs Git - rust.git/blobdiff - tests/ui/single_match.stderr
iterate List by value
[rust.git] / tests / ui / single_match.stderr
index d77211bc12613b937dfda8d06688c919f34ef740..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:9:5
+  --> $DIR/single_match.rs:8:5
    |
-9  | /     match x {
-10 | |         Some(y) => { println!("{:?}", y); }
-11 | |         _ => ()
-12 | |     };
-   | |_____^ help: try this: `if let Some(y) = x { println!("{:?}", y); }`
+LL | /     match x {
+LL | |         Some(y) => {
+LL | |             println!("{:?}", y);
+LL | |         },
+LL | |         _ => (),
+LL | |     };
+   | |_____^
    |
-   = note: `-D single-match` implied by `-D warnings`
+   = 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:15:5
+  --> $DIR/single_match.rs:25:5
    |
-15 | /     match z {
-16 | |         (2...3, 7...9) => dummy(),
-17 | |         _ => {}
-18 | |     };
-   | |_____^ 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:41:5
+  --> $DIR/single_match.rs:54:5
    |
-41 | /     match x {
-42 | |         Some(y) => dummy(),
-43 | |         None => ()
-44 | |     };
+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:46:5
+  --> $DIR/single_match.rs:59:5
    |
-46 | /     match y {
-47 | |         Ok(y) => dummy(),
-48 | |         Err(..) => ()
-49 | |     };
+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:53:5
+  --> $DIR/single_match.rs:66:5
    |
-53 | /     match c {
-54 | |         Cow::Borrowed(..) => dummy(),
-55 | |         Cow::Owned(..) => (),
-56 | |     };
+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