Skip to content

Instantly share code, notes, and snippets.

@jimmycuadra
Created May 22, 2016 17:38
Show Gist options
  • Save jimmycuadra/4182662903ea842bf6745035143414d4 to your computer and use it in GitHub Desktop.
Save jimmycuadra/4182662903ea842bf6745035143414d4 to your computer and use it in GitHub Desktop.
Tuple pattern match in for loop
src/lib.rs:210:17: 210:36 error: mismatched types [E0308]
src/lib.rs:210 for (field_name, field) in &numbers_to_check {
^~~~~~~~~~~~~~~~~~~
src/lib.rs:210:17: 210:36 help: run `rustc --explain E0308` to see a detailed explanation
src/lib.rs:210:17: 210:36 note: expected type `&(&str, std::option::Option<tests::PhoneNumber>)`
src/lib.rs:210:17: 210:36 note: found type `(_, _)`
let numbers_to_check = [
("home_number", self.home_number),
("cell_number", self.cell_number),
];
for (field_name, field) in &numbers_to_check {
// ...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment