summaryrefslogtreecommitdiffstats
path: root/tests/ui/deref-patterns/basic.rs
blob: 249716040a17702a8a58669f1e0ef92fabc7da4e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// run-pass
// check-run-results
#![feature(string_deref_patterns)]

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"),
    }
}