@@ -20,8 +20,8 @@ pub(super) fn check_for_loop_over_map_kv<'tcx>(
20
20
let arg_span = arg. span ;
21
21
let ( new_pat_span, kind, ty, mutbl) = match * cx. typeck_results ( ) . expr_ty ( arg) . kind ( ) {
22
22
ty:: Ref ( _, ty, mutbl) => match ( & pat[ 0 ] . kind , & pat[ 1 ] . kind ) {
23
- ( key, _) if pat_is_wild ( key, body) => ( pat[ 1 ] . span , "value" , ty, mutbl) ,
24
- ( _, value) if pat_is_wild ( value, body) => ( pat[ 0 ] . span , "key" , ty, Mutability :: Not ) ,
23
+ ( key, _) if pat_is_wild ( cx , key, body) => ( pat[ 1 ] . span , "value" , ty, mutbl) ,
24
+ ( _, value) if pat_is_wild ( cx , value, body) => ( pat[ 0 ] . span , "key" , ty, Mutability :: Not ) ,
25
25
_ => return ,
26
26
} ,
27
27
_ => return ,
@@ -59,11 +59,11 @@ pub(super) fn check_for_loop_over_map_kv<'tcx>(
59
59
}
60
60
61
61
/// Returns `true` if the pattern is a `PatWild` or an ident prefixed with `_`.
62
- fn pat_is_wild < ' tcx > ( pat : & ' tcx PatKind < ' _ > , body : & ' tcx Expr < ' _ > ) -> bool {
62
+ fn pat_is_wild < ' tcx > ( cx : & LateContext < ' tcx > , pat : & ' tcx PatKind < ' _ > , body : & ' tcx Expr < ' _ > ) -> bool {
63
63
match * pat {
64
64
PatKind :: Wild => true ,
65
65
PatKind :: Binding ( _, id, ident, None ) if ident. as_str ( ) . starts_with ( '_' ) => {
66
- !LocalUsedVisitor :: new ( id) . check_expr ( body)
66
+ !LocalUsedVisitor :: new ( cx , id) . check_expr ( body)
67
67
} ,
68
68
_ => false ,
69
69
}
0 commit comments