]> git.lizzy.rs Git - rust.git/blob - src/test/ui/deref-patterns/basic.rs
Rollup merge of #104581 - notriddle:notriddle/js-iife-2, r=GuillaumeGomez
[rust.git] / src / test / ui / deref-patterns / basic.rs
1 // run-pass
2 // check-run-results
3 #![feature(string_deref_patterns)]
4
5 fn main() {
6     test(Some(String::from("42")));
7     test(Some(String::new()));
8     test(None);
9 }
10
11 fn test(o: Option<String>) {
12     match o {
13         Some("42") => println!("the answer"),
14         Some(_) => println!("something else?"),
15         None => println!("nil"),
16     }
17 }