File tree Expand file tree Collapse file tree 1 file changed +1
-2
lines changed Expand file tree Collapse file tree 1 file changed +1
-2
lines changed Original file line number Diff line number Diff line change @@ -10,15 +10,14 @@ use super::CLONED_LAST;
10
10
11
11
/// lint use of `cloned().next()` for `Iterators`
12
12
pub ( super ) fn check < ' tcx > ( cx : & LateContext < ' tcx > , expr : & ' tcx hir:: Expr < ' _ > , recv : & ' tcx hir:: Expr < ' _ > ) {
13
- // lint if caller of `.filter ().next()` is an Iterator
13
+ // lint if caller of `.cloned ().next()` is an Iterator
14
14
let recv_impls_iterator = cx. tcx . get_diagnostic_item ( sym:: Iterator ) . map_or ( false , |id| {
15
15
implements_trait ( cx, cx. typeck_results ( ) . expr_ty ( recv) , id, & [ ] )
16
16
} ) ;
17
17
if recv_impls_iterator {
18
18
let msg = "called `cloned().last()` on an `Iterator`. It may be more efficient to call
19
19
`.last().clone()` instead" ;
20
20
let iter_snippet = snippet ( cx, recv. span , ".." ) ;
21
- // add note if not multi-line
22
21
span_lint_and_sugg (
23
22
cx,
24
23
CLONED_LAST ,
You can’t perform that action at this time.
0 commit comments