1 use clippy_utils::diagnostics::span_lint_and_help;
2 use clippy_utils::is_trait_method;
4 use rustc_lint::LateContext;
7 use super::SKIP_WHILE_NEXT;
9 /// lint use of `skip_while().next()` for `Iterators`
10 pub(super) fn check<'tcx>(cx: &LateContext<'tcx>, expr: &'tcx hir::Expr<'_>) {
11 // lint if caller of `.skip_while().next()` is an Iterator
12 if is_trait_method(cx, expr, sym::Iterator) {
17 "called `skip_while(<p>).next()` on an `Iterator`",
19 "this is more succinctly expressed by calling `.find(!<p>)` instead",