mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-24 21:53:23 +00:00
12 lines
292 B
Rust
12 lines
292 B
Rust
#![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);
|
|
let _ = [1].iter().filter_map(Some);
|
|
|
|
// nay
|
|
let _ = [1].iter().flat_map(|_| &Some(1));
|
|
}
|