2018-08-30 14:18:55 +02:00
|
|
|
// run-pass
|
2015-03-22 13:13:15 -07:00
|
|
|
|
2015-03-25 17:06:52 -07:00
|
|
|
fn destructure(x: Option<isize>) -> isize {
|
2012-08-06 16:13:52 -07:00
|
|
|
match x {
|
2012-08-20 12:23:37 -07:00
|
|
|
None => 0,
|
|
|
|
Some(ref v) => *v
|
2012-08-06 07:20:23 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-02-01 19:43:17 -08:00
|
|
|
pub fn main() {
|
2013-05-18 22:02:45 -04:00
|
|
|
assert_eq!(destructure(Some(22)), 22);
|
2012-08-06 16:13:52 -07:00
|
|
|
}
|