@@ -5,6 +5,7 @@ mod expect_used;
55mod filetype_is_file;
66mod filter_map;
77mod filter_map_identity;
8+ mod filter_map_map;
89mod filter_next;
910mod from_iter_instead_of_collect;
1011mod get_unwrap;
@@ -1700,7 +1701,7 @@ impl<'tcx> LateLintPass<'tcx> for Methods {
17001701 [ "next" , "skip_while" ] => skip_while_next:: check ( cx, expr, arg_lists[ 1 ] ) ,
17011702 [ "next" , "iter" ] => iter_next_slice:: check ( cx, expr, arg_lists[ 1 ] ) ,
17021703 [ "map" , "filter" ] => filter_map:: check ( cx, expr, false ) ,
1703- [ "map" , "filter_map" ] => lint_filter_map_map ( cx, expr, arg_lists[ 1 ] , arg_lists[ 0 ] ) ,
1704+ [ "map" , "filter_map" ] => filter_map_map :: check ( cx, expr, arg_lists[ 1 ] , arg_lists[ 0 ] ) ,
17041705 [ "next" , "filter_map" ] => lint_filter_map_next ( cx, expr, arg_lists[ 1 ] , self . msrv . as_ref ( ) ) ,
17051706 [ "map" , "find" ] => filter_map:: check ( cx, expr, true ) ,
17061707 [ "flat_map" , "filter" ] => lint_filter_flat_map ( cx, expr, arg_lists[ 1 ] , arg_lists[ 0 ] ) ,
@@ -2785,21 +2786,6 @@ fn lint_filter_map_next<'tcx>(
27852786 }
27862787}
27872788
2788- /// lint use of `filter_map().map()` for `Iterators`
2789- fn lint_filter_map_map < ' tcx > (
2790- cx : & LateContext < ' tcx > ,
2791- expr : & ' tcx hir:: Expr < ' _ > ,
2792- _filter_args : & ' tcx [ hir:: Expr < ' _ > ] ,
2793- _map_args : & ' tcx [ hir:: Expr < ' _ > ] ,
2794- ) {
2795- // lint if caller of `.filter_map().map()` is an Iterator
2796- if match_trait_method ( cx, expr, & paths:: ITERATOR ) {
2797- let msg = "called `filter_map(..).map(..)` on an `Iterator`" ;
2798- let hint = "this is more succinctly expressed by only calling `.filter_map(..)` instead" ;
2799- span_lint_and_help ( cx, FILTER_MAP , expr. span , msg, None , hint) ;
2800- }
2801- }
2802-
28032789/// lint use of `filter().flat_map()` for `Iterators`
28042790fn lint_filter_flat_map < ' tcx > (
28052791 cx : & LateContext < ' tcx > ,
0 commit comments