rust/tests/ui/binding/borrowed-ptr-pattern-2.rs

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

14 lines
210 B
Rust
Raw Normal View History

// run-pass
fn foo(s: &String) -> bool {
match &**s {
"kitty" => true,
2012-09-23 07:39:39 -05:00
_ => false
2012-09-07 19:07:32 -05:00
}
}
pub fn main() {
assert!(foo(&"kitty".to_string()));
assert!(!foo(&"gata".to_string()));
2012-09-23 07:39:39 -05:00
}