mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-26 08:44:35 +00:00
15 lines
253 B
Rust
15 lines
253 B
Rust
//@ run-pass
|
|
// rustc --test match_borrowed_str.rs.rs && ./match_borrowed_str.rs
|
|
|
|
|
|
fn compare(x: &str, y: &str) -> bool {
|
|
match x {
|
|
"foo" => y == "foo",
|
|
_ => y == "bar",
|
|
}
|
|
}
|
|
|
|
pub fn main() {
|
|
assert!(compare("foo", "foo"));
|
|
}
|