mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-04 20:54:13 +00:00
14 lines
303 B
Rust
14 lines
303 B
Rust
// run-rustfix
|
|
#![warn(clippy::flat_map_option)]
|
|
#![allow(clippy::redundant_closure, clippy::unnecessary_filter_map)]
|
|
|
|
fn main() {
|
|
// yay
|
|
let c = |x| Some(x);
|
|
let _ = [1].iter().flat_map(c);
|
|
let _ = [1].iter().flat_map(Some);
|
|
|
|
// nay
|
|
let _ = [1].iter().flat_map(|_| &Some(1));
|
|
}
|