about summary refs log tree commit diff
path: root/tests/ui/deref-patterns/basic.rs
blob: d76fb697f406261d0360cf8c5862850ff718a71d (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"),
    }
}