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