@@ -19,9 +19,8 @@ pub(super) fn check<'tcx>(
19
19
name : & str ,
20
20
map_arg : & [ hir:: Expr < ' _ > ] ,
21
21
) {
22
- let recv_ty = cx. typeck_results ( ) . expr_ty_adjusted ( recv) ;
23
22
// Check if it's iterator and get type associated with `Item`.
24
- let inner_ty = match get_iterator_item_ty ( cx, recv_ty ) {
23
+ let inner_ty = match get_iterator_item_ty ( cx, cx . typeck_results ( ) . expr_ty_adjusted ( recv ) ) {
25
24
Some ( ty) => ty,
26
25
_ => return ,
27
26
} ;
@@ -31,7 +30,7 @@ pub(super) fn check<'tcx>(
31
30
_ => return ,
32
31
} ;
33
32
34
- let ( lint, preserve_clopned ) = match name {
33
+ let ( lint, preserve_cloned ) = match name {
35
34
"count" => ( REDUNDANT_CLONE , false ) ,
36
35
_ => ( ITER_OVEREAGER_CLONED , true ) ,
37
36
} ;
@@ -43,10 +42,9 @@ pub(super) fn check<'tcx>(
43
42
wildcard_params,
44
43
name,
45
44
wildcard_params,
46
- preserve_clopned . then( || ".cloned()" ) . unwrap_or_default( ) ,
45
+ preserve_cloned . then( || ".cloned()" ) . unwrap_or_default( ) ,
47
46
) ;
48
47
49
- let iter_snippet = snippet ( cx, recv. span , ".." ) ;
50
48
span_lint_and_sugg (
51
49
cx,
52
50
lint,
@@ -55,10 +53,10 @@ pub(super) fn check<'tcx>(
55
53
"try this" ,
56
54
format ! (
57
55
"{}.{}({}){}" ,
58
- iter_snippet ,
56
+ snippet ( cx , recv . span , ".." ) ,
59
57
name,
60
58
map_arg. iter( ) . map( |a| snippet( cx, a. span, ".." ) ) . join( ", " ) ,
61
- preserve_clopned . then( || ".cloned()" ) . unwrap_or_default( ) ,
59
+ preserve_cloned . then( || ".cloned()" ) . unwrap_or_default( ) ,
62
60
) ,
63
61
Applicability :: MachineApplicable ,
64
62
) ;
0 commit comments