Files
rust/src/test/ui/deref-patterns/basic.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

16 lines
309 B
Rust
Raw Normal View History

// run-pass
// check-run-results
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"),
}
}