@@ -674,7 +674,7 @@ fn never_loop_expr(expr: &Expr, main_loop_id: HirId) -> NeverLoopResult {
674674 | ExprKind :: Cast ( ref e, _)
675675 | ExprKind :: Type ( ref e, _)
676676 | ExprKind :: Field ( ref e, _)
677- | ExprKind :: AddrOf ( _, ref e)
677+ | ExprKind :: AddrOf ( _, _ , ref e)
678678 | ExprKind :: Struct ( _, _, Some ( ref e) )
679679 | ExprKind :: Repeat ( ref e, _)
680680 | ExprKind :: DropTemps ( ref e) => never_loop_expr ( e, main_loop_id) ,
@@ -1504,7 +1504,9 @@ fn make_iterator_snippet(cx: &LateContext<'_, '_>, arg: &Expr, applic_ref: &mut
15041504 // (&x).into_iter() ==> x.iter()
15051505 // (&mut x).into_iter() ==> x.iter_mut()
15061506 match & arg. kind {
1507- ExprKind :: AddrOf ( mutability, arg_inner) if has_iter_method ( cx, cx. tables . expr_ty ( & arg_inner) ) . is_some ( ) => {
1507+ ExprKind :: AddrOf ( BorrowKind :: Ref , mutability, arg_inner)
1508+ if has_iter_method ( cx, cx. tables . expr_ty ( & arg_inner) ) . is_some ( ) =>
1509+ {
15081510 let meth_name = match mutability {
15091511 Mutability :: Mutable => "iter_mut" ,
15101512 Mutability :: Immutable => "iter" ,
@@ -1514,7 +1516,7 @@ fn make_iterator_snippet(cx: &LateContext<'_, '_>, arg: &Expr, applic_ref: &mut
15141516 sugg:: Sugg :: hir_with_applicability( cx, & arg_inner, "_" , applic_ref) . maybe_par( ) ,
15151517 meth_name,
15161518 )
1517- } ,
1519+ }
15181520 _ => format ! (
15191521 "{}.into_iter()" ,
15201522 sugg:: Sugg :: hir_with_applicability( cx, arg, "_" , applic_ref) . maybe_par( )
@@ -1549,7 +1551,7 @@ fn check_for_loop_over_map_kv<'a, 'tcx>(
15491551 Mutability :: Mutable => "_mut" ,
15501552 } ;
15511553 let arg = match arg. kind {
1552- ExprKind :: AddrOf ( _, ref expr) => & * * expr,
1554+ ExprKind :: AddrOf ( BorrowKind :: Ref , _, ref expr) => & * * expr,
15531555 _ => arg,
15541556 } ;
15551557
@@ -1873,7 +1875,7 @@ impl<'a, 'tcx> Visitor<'tcx> for VarVisitor<'a, 'tcx> {
18731875 self . prefer_mutable = false ;
18741876 self . visit_expr ( rhs) ;
18751877 } ,
1876- ExprKind :: AddrOf ( mutbl, ref expr) => {
1878+ ExprKind :: AddrOf ( BorrowKind :: Ref , mutbl, ref expr) => {
18771879 if mutbl == Mutability :: Mutable {
18781880 self . prefer_mutable = true ;
18791881 }
@@ -2090,7 +2092,9 @@ impl<'a, 'tcx> Visitor<'tcx> for IncrementVisitor<'a, 'tcx> {
20902092 }
20912093 } ,
20922094 ExprKind :: Assign ( ref lhs, _) if lhs. hir_id == expr. hir_id => * state = VarState :: DontWarn ,
2093- ExprKind :: AddrOf ( mutability, _) if mutability == Mutability :: Mutable => * state = VarState :: DontWarn ,
2095+ ExprKind :: AddrOf ( BorrowKind :: Ref , mutability, _) if mutability == Mutability :: Mutable => {
2096+ * state = VarState :: DontWarn
2097+ } ,
20942098 _ => ( ) ,
20952099 }
20962100 }
@@ -2172,7 +2176,7 @@ impl<'a, 'tcx> Visitor<'tcx> for InitializeVisitor<'a, 'tcx> {
21722176 VarState :: DontWarn
21732177 }
21742178 } ,
2175- ExprKind :: AddrOf ( mutability, _) if mutability == Mutability :: Mutable => {
2179+ ExprKind :: AddrOf ( BorrowKind :: Ref , mutability, _) if mutability == Mutability :: Mutable => {
21762180 self . state = VarState :: DontWarn
21772181 } ,
21782182 _ => ( ) ,
0 commit comments