2022-07-05 02:19:13 -05:00
|
|
|
// run-pass
|
|
|
|
// check-run-results
|
2022-11-11 08:31:07 -06:00
|
|
|
#![feature(string_deref_patterns)]
|
2022-07-05 02:19:13 -05:00
|
|
|
|
|
|
|
fn main() {
|
|
|
|
test(Some(String::from("42")));
|
|
|
|
test(Some(String::new()));
|
|
|
|
test(None);
|
|
|
|
}
|
|
|
|
|
|
|
|
fn test(o: Option<String>) {
|
|
|
|
match o {
|
|
|
|
Some("42") => println!("the answer"),
|
|
|
|
Some(_) => println!("something else?"),
|
|
|
|
None => println!("nil"),
|
|
|
|
}
|
2022-07-05 02:42:19 -05:00
|
|
|
}
|