Files
rust/tests/ui/flat_map_option.fixed

15 lines
342 B
Rust
Raw Normal View History

2021-04-16 15:06:21 -05:00
#![warn(clippy::flat_map_option)]
#![allow(clippy::redundant_closure, clippy::unnecessary_filter_map)]
fn main() {
// yay
let c = |x| Some(x);
let _ = [1].iter().filter_map(c);
2025-02-11 17:57:08 +01:00
//~^ flat_map_option
2021-04-16 15:06:21 -05:00
let _ = [1].iter().filter_map(Some);
2025-02-11 17:57:08 +01:00
//~^ flat_map_option
2021-04-16 15:06:21 -05:00
// nay
let _ = [1].iter().flat_map(|_| &Some(1));
}