@@ -674,7 +674,7 @@ fn never_loop_expr(expr: &Expr, main_loop_id: HirId) -> NeverLoopResult {
674
674
| ExprKind :: Cast ( ref e, _)
675
675
| ExprKind :: Type ( ref e, _)
676
676
| ExprKind :: Field ( ref e, _)
677
- | ExprKind :: AddrOf ( _, ref e)
677
+ | ExprKind :: AddrOf ( _, _ , ref e)
678
678
| ExprKind :: Struct ( _, _, Some ( ref e) )
679
679
| ExprKind :: Repeat ( ref e, _)
680
680
| 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
1504
1504
// (&x).into_iter() ==> x.iter()
1505
1505
// (&mut x).into_iter() ==> x.iter_mut()
1506
1506
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
+ {
1508
1510
let meth_name = match mutability {
1509
1511
Mutability :: Mutable => "iter_mut" ,
1510
1512
Mutability :: Immutable => "iter" ,
@@ -1514,7 +1516,7 @@ fn make_iterator_snippet(cx: &LateContext<'_, '_>, arg: &Expr, applic_ref: &mut
1514
1516
sugg:: Sugg :: hir_with_applicability( cx, & arg_inner, "_" , applic_ref) . maybe_par( ) ,
1515
1517
meth_name,
1516
1518
)
1517
- } ,
1519
+ }
1518
1520
_ => format ! (
1519
1521
"{}.into_iter()" ,
1520
1522
sugg:: Sugg :: hir_with_applicability( cx, arg, "_" , applic_ref) . maybe_par( )
@@ -1549,7 +1551,7 @@ fn check_for_loop_over_map_kv<'a, 'tcx>(
1549
1551
Mutability :: Mutable => "_mut" ,
1550
1552
} ;
1551
1553
let arg = match arg. kind {
1552
- ExprKind :: AddrOf ( _, ref expr) => & * * expr,
1554
+ ExprKind :: AddrOf ( BorrowKind :: Ref , _, ref expr) => & * * expr,
1553
1555
_ => arg,
1554
1556
} ;
1555
1557
@@ -1873,7 +1875,7 @@ impl<'a, 'tcx> Visitor<'tcx> for VarVisitor<'a, 'tcx> {
1873
1875
self . prefer_mutable = false ;
1874
1876
self . visit_expr ( rhs) ;
1875
1877
} ,
1876
- ExprKind :: AddrOf ( mutbl, ref expr) => {
1878
+ ExprKind :: AddrOf ( BorrowKind :: Ref , mutbl, ref expr) => {
1877
1879
if mutbl == Mutability :: Mutable {
1878
1880
self . prefer_mutable = true ;
1879
1881
}
@@ -2090,7 +2092,9 @@ impl<'a, 'tcx> Visitor<'tcx> for IncrementVisitor<'a, 'tcx> {
2090
2092
}
2091
2093
} ,
2092
2094
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
+ } ,
2094
2098
_ => ( ) ,
2095
2099
}
2096
2100
}
@@ -2172,7 +2176,7 @@ impl<'a, 'tcx> Visitor<'tcx> for InitializeVisitor<'a, 'tcx> {
2172
2176
VarState :: DontWarn
2173
2177
}
2174
2178
} ,
2175
- ExprKind :: AddrOf ( mutability, _) if mutability == Mutability :: Mutable => {
2179
+ ExprKind :: AddrOf ( BorrowKind :: Ref , mutability, _) if mutability == Mutability :: Mutable => {
2176
2180
self . state = VarState :: DontWarn
2177
2181
} ,
2178
2182
_ => ( ) ,
0 commit comments