diff options
Diffstat (limited to 'src/tools/clippy/tests/ui/flat_map_option.fixed')
-rw-r--r-- | src/tools/clippy/tests/ui/flat_map_option.fixed | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/tools/clippy/tests/ui/flat_map_option.fixed b/src/tools/clippy/tests/ui/flat_map_option.fixed new file mode 100644 index 000000000..6a34f0089 --- /dev/null +++ b/src/tools/clippy/tests/ui/flat_map_option.fixed @@ -0,0 +1,13 @@ +// 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().filter_map(c); + let _ = [1].iter().filter_map(Some); + + // nay + let _ = [1].iter().flat_map(|_| &Some(1)); +} |