mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-24 07:44:10 +00:00
22 lines
482 B
Rust
22 lines
482 B
Rust
//@ run-pass
|
|
|
|
fn main() {
|
|
let value = Some(1);
|
|
assert_eq!(match value {
|
|
ref a @ Some(_) => a,
|
|
ref b @ None => b
|
|
}, &Some(1));
|
|
assert_eq!(match value {
|
|
ref c @ Some(_) => c,
|
|
ref b @ None => b
|
|
}, &Some(1));
|
|
assert_eq!(match "foobarbaz" {
|
|
b @ _ => b
|
|
}, "foobarbaz");
|
|
let a @ _ = "foobarbaz";
|
|
assert_eq!(a, "foobarbaz");
|
|
let value = Some(true);
|
|
let ref a @ _ = value;
|
|
assert_eq!(a, &Some(true));
|
|
}
|