Add regression test for stack overflow in redundant_pattern_matching

This commit is contained in:
flip1995 2021-05-05 15:35:14 +02:00
parent 344f04bea6
commit 59874f3bea
No known key found for this signature in database
GPG Key ID: 1CA0DF2AF59D68A5
2 changed files with 19 additions and 0 deletions

View File

@ -0,0 +1,9 @@
#[derive(Default)]
struct A<T> {
a: Vec<A<T>>,
b: T,
}
fn main() {
if let Ok(_) = Ok::<_, ()>(A::<String>::default()) {}
}

View File

@ -0,0 +1,10 @@
error: redundant pattern matching, consider using `is_ok()`
--> $DIR/ice-7169.rs:8:12
|
LL | if let Ok(_) = Ok::<_, ()>(A::<String>::default()) {}
| -------^^^^^-------------------------------------- help: try this: `if Ok::<_, ()>(A::<String>::default()).is_ok()`
|
= note: `-D clippy::redundant-pattern-matching` implied by `-D warnings`
error: aborting due to previous error