@@ -11,6 +11,7 @@ mod iter_count;
11
11
mod manual_saturating_arithmetic;
12
12
mod ok_expect;
13
13
mod option_map_unwrap_or;
14
+ mod skip_while_next;
14
15
mod unnecessary_filter_map;
15
16
mod unnecessary_lazy_eval;
16
17
mod unwrap_used;
@@ -1679,7 +1680,7 @@ impl<'tcx> LateLintPass<'tcx> for Methods {
1679
1680
}
1680
1681
} ,
1681
1682
[ "next" , "filter" ] => filter_next:: check ( cx, expr, arg_lists[ 1 ] ) ,
1682
- [ "next" , "skip_while" ] => lint_skip_while_next ( cx, expr, arg_lists[ 1 ] ) ,
1683
+ [ "next" , "skip_while" ] => skip_while_next :: check ( cx, expr, arg_lists[ 1 ] ) ,
1683
1684
[ "next" , "iter" ] => lint_iter_next ( cx, expr, arg_lists[ 1 ] ) ,
1684
1685
[ "map" , "filter" ] => lint_filter_map ( cx, expr, false ) ,
1685
1686
[ "map" , "filter_map" ] => lint_filter_map_map ( cx, expr, arg_lists[ 1 ] , arg_lists[ 0 ] ) ,
@@ -2965,25 +2966,6 @@ fn lint_map_or_none<'tcx>(cx: &LateContext<'tcx>, expr: &'tcx hir::Expr<'_>, map
2965
2966
) ;
2966
2967
}
2967
2968
2968
- /// lint use of `skip_while().next()` for `Iterators`
2969
- fn lint_skip_while_next < ' tcx > (
2970
- cx : & LateContext < ' tcx > ,
2971
- expr : & ' tcx hir:: Expr < ' _ > ,
2972
- _skip_while_args : & ' tcx [ hir:: Expr < ' _ > ] ,
2973
- ) {
2974
- // lint if caller of `.skip_while().next()` is an Iterator
2975
- if match_trait_method ( cx, expr, & paths:: ITERATOR ) {
2976
- span_lint_and_help (
2977
- cx,
2978
- SKIP_WHILE_NEXT ,
2979
- expr. span ,
2980
- "called `skip_while(<p>).next()` on an `Iterator`" ,
2981
- None ,
2982
- "this is more succinctly expressed by calling `.find(!<p>)` instead" ,
2983
- ) ;
2984
- }
2985
- }
2986
-
2987
2969
/// lint use of `filter().map()` or `find().map()` for `Iterators`
2988
2970
fn lint_filter_map < ' tcx > ( cx : & LateContext < ' tcx > , expr : & ' tcx hir:: Expr < ' _ > , is_find : bool ) {
2989
2971
if_chain ! {
0 commit comments