File tree 2 files changed +12
-5
lines changed
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>(
2563
2563
) {
2564
2564
// lint if caller of `.skip_while().next()` is an Iterator
2565
2565
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
+ ) ;
2569
2573
}
2570
2574
}
2571
2575
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`
2
2
--> $DIR/skip_while_next.rs:14:13
3
3
|
4
4
LL | let _ = v.iter().skip_while(|&x| *x < 0).next();
5
5
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6
6
|
7
7
= note: `-D clippy::skip-while-next` implied by `-D warnings`
8
+ = help: this is more succinctly expressed by calling `.find(!p)` instead
8
9
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`
10
11
--> $DIR/skip_while_next.rs:17:13
11
12
|
12
13
LL | let _ = v.iter().skip_while(|&x| {
@@ -15,6 +16,8 @@ LL | | *x < 0
15
16
LL | | }
16
17
LL | | ).next();
17
18
| |___________________________^
19
+ |
20
+ = help: this is more succinctly expressed by calling `.find(!p)` instead
18
21
19
22
error: aborting due to 2 previous errors
20
23
You can’t perform that action at this time.
0 commit comments