matches: special message for this case
match &e { &Pat1 => {}, &Pat2 => {}, ... }
(inspired by dogfood fixes)
This commit is contained in:
parent
8f1a237493
commit
7580da306e
2 changed files with 20 additions and 13 deletions
|
|
@ -53,6 +53,12 @@ fn ref_pats() {
|
|||
&(v, 1) => println!("{}", v),
|
||||
_ => println!("none"),
|
||||
}
|
||||
// special case: using & both in expr and pats
|
||||
let w = Some(0);
|
||||
match &w { //~ERROR you don't need to add `&` to both
|
||||
&Some(v) => println!("{:?}", v),
|
||||
&None => println!("none"),
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue