File tree Expand file tree Collapse file tree 2 files changed +12
-5
lines changed Expand file tree Collapse file tree 2 files changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -2563,9 +2563,13 @@ fn lint_skip_while_next<'a, 'tcx>(
25632563) {
25642564 // lint if caller of `.skip_while().next()` is an Iterator
25652565 if match_trait_method ( cx, expr, & paths:: ITERATOR ) {
2566- let msg = "called `skip_while(p).next()` on an `Iterator`. \
2567- This is more succinctly expressed by calling `.find(!p)` instead.";
2568- span_lint ( cx, SKIP_WHILE_NEXT , expr. span , msg) ;
2566+ span_help_and_lint (
2567+ cx,
2568+ SKIP_WHILE_NEXT ,
2569+ expr. span ,
2570+ "called `skip_while(p).next()` on an `Iterator`" ,
2571+ "this is more succinctly expressed by calling `.find(!p)` instead" ,
2572+ ) ;
25692573 }
25702574}
25712575
Original file line number Diff line number Diff line change 1- error: called `skip_while(p).next()` on an `Iterator`. This is more succinctly expressed by calling `.find(!p)` instead.
1+ error: called `skip_while(p).next()` on an `Iterator`
22 --> $DIR/skip_while_next.rs:14:13
33 |
44LL | let _ = v.iter().skip_while(|&x| *x < 0).next();
55 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
66 |
77 = note: `-D clippy::skip-while-next` implied by `-D warnings`
8+ = help: this is more succinctly expressed by calling `.find(!p)` instead
89
9- error: called `skip_while(p).next()` on an `Iterator`. This is more succinctly expressed by calling `.find(!p)` instead.
10+ error: called `skip_while(p).next()` on an `Iterator`
1011 --> $DIR/skip_while_next.rs:17:13
1112 |
1213LL | let _ = v.iter().skip_while(|&x| {
@@ -15,6 +16,8 @@ LL | | *x < 0
1516LL | | }
1617LL | | ).next();
1718 | |___________________________^
19+ |
20+ = help: this is more succinctly expressed by calling `.find(!p)` instead
1821
1922error: aborting due to 2 previous errors
2023
You can’t perform that action at this time.
0 commit comments