mirror of
https://github.com/rust-lang/rust.git
synced 2025-04-13 12:36:47 +00:00
Add false positive test for manual_flatten
Add a scenario where `manual_flatten` is triggered when match expression will still be used after the match in `if let`.
This commit is contained in:
parent
3f0c97740f
commit
711c5cb6d2
@ -91,6 +91,19 @@ fn main() {
|
||||
}
|
||||
}
|
||||
|
||||
struct Test {
|
||||
a: usize,
|
||||
}
|
||||
|
||||
let mut vec_of_struct = [Some(Test { a: 1 }), None];
|
||||
|
||||
// Usage of `if let` expression should not trigger lint
|
||||
for n in vec_of_struct.iter_mut() {
|
||||
if let Some(z) = n {
|
||||
*n = None;
|
||||
}
|
||||
}
|
||||
|
||||
// Using manual flatten should not trigger the lint
|
||||
for n in vec![Some(1), Some(2), Some(3)].iter().flatten() {
|
||||
println!("{}", n);
|
||||
|
Loading…
Reference in New Issue
Block a user