Last active
August 8, 2017 03:00
-
-
Save uzimith/f5e2c99c7af0222d9516613b5887b1a0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn main() { | |
let mut vec = vec!("1", "1"); | |
let first = vec.pop(); | |
let second = vec.pop(); | |
match (first, second) { | |
(Some(a), Some(b)) if a == b => print!("yes"), | |
(Some(_), Some(_)) => print!("hi"), | |
_ => print!("no") | |
} | |
} | |
// yes | |
fn main() { | |
let mut vec = vec!("1".to_string(), "1".to_string()); | |
let first = vec.pop(); | |
let second = vec.pop(); | |
match (first, second) { | |
(Some(a), Some(b)) if a == b => print!("yes"), | |
(Some(_), Some(_)) => print!("hi"), | |
_ => print!("no") | |
} | |
} | |
/* | |
error[E0008]: cannot bind by-move into a pattern guard | |
--> src/main.rs:6:15 | |
| | |
6 | (Some(a), Some(b)) if a == b => print!("yes"), | |
| ^ moves value into pattern guard | |
error[E0008]: cannot bind by-move into a pattern guard | |
--> src/main.rs:6:24 | |
| | |
6 | (Some(a), Some(b)) if a == b => print!("yes"), | |
| ^ moves value into pattern guard | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment