fn select(x: &r/Option, y: &r/Option) -> &r/Option { match (x, y) { (&None, &None) => x, (&Some(_), _) => x, (&None, &Some(_)) => y } } fn main() { let x = None; let y = Some(3); assert select(&x, &y).get() == 3; }