Add another test.
This commit is contained in:
parent
f8dbd32433
commit
3eb642bcdd
@ -285,6 +285,14 @@ fn match_wild_err_arm() {
|
||||
Err(_) => println!("err")
|
||||
}
|
||||
|
||||
// this is a current false positive, see #1996
|
||||
match x {
|
||||
Ok(3) => println!("ok"),
|
||||
Ok(x) if x*x == 64 => println!("ok 64"),
|
||||
Ok(_) => println!("ok"),
|
||||
Err(_) => println!("err")
|
||||
}
|
||||
|
||||
match (x, Some(1i32)) {
|
||||
(Ok(x), Some(_)) => println!("ok {}", x),
|
||||
(Ok(_), Some(x)) => println!("ok {}", x),
|
||||
|
@ -391,20 +391,38 @@ note: consider refactoring into `Ok(3) | Ok(_)`
|
||||
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
|
||||
|
||||
error: this `match` has identical arm bodies
|
||||
--> $DIR/matches.rs:290:29
|
||||
--> $DIR/matches.rs:292:18
|
||||
|
|
||||
290 | (Ok(_), Some(x)) => println!("ok {}", x),
|
||||
292 | Ok(_) => println!("ok"),
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
|
||||
note: same as this
|
||||
--> $DIR/matches.rs:290:18
|
||||
|
|
||||
290 | Ok(3) => println!("ok"),
|
||||
| ^^^^^^^^^^^^^^
|
||||
note: consider refactoring into `Ok(3) | Ok(_)`
|
||||
--> $DIR/matches.rs:290:18
|
||||
|
|
||||
290 | Ok(3) => println!("ok"),
|
||||
| ^^^^^^^^^^^^^^
|
||||
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
|
||||
|
||||
error: this `match` has identical arm bodies
|
||||
--> $DIR/matches.rs:298:29
|
||||
|
|
||||
298 | (Ok(_), Some(x)) => println!("ok {}", x),
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
note: same as this
|
||||
--> $DIR/matches.rs:289:29
|
||||
--> $DIR/matches.rs:297:29
|
||||
|
|
||||
289 | (Ok(x), Some(_)) => println!("ok {}", x),
|
||||
297 | (Ok(x), Some(_)) => println!("ok {}", x),
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
note: consider refactoring into `(Ok(x), Some(_)) | (Ok(_), Some(x))`
|
||||
--> $DIR/matches.rs:289:29
|
||||
--> $DIR/matches.rs:297:29
|
||||
|
|
||||
289 | (Ok(x), Some(_)) => println!("ok {}", x),
|
||||
297 | (Ok(x), Some(_)) => println!("ok {}", x),
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user