@@ -263,14 +263,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
263
263
let by_ref_binop = !op. node . is_by_value ( ) ;
264
264
if is_assign == IsAssign :: Yes || by_ref_binop {
265
265
if let ty:: Ref ( region, _, mutbl) = method. sig . inputs ( ) [ 0 ] . kind ( ) {
266
- let mutbl = match mutbl {
267
- hir:: Mutability :: Not => AutoBorrowMutability :: Not ,
268
- hir:: Mutability :: Mut => AutoBorrowMutability :: Mut {
269
- // Allow two-phase borrows for binops in initial deployment
270
- // since they desugar to methods
271
- allow_two_phase_borrow : AllowTwoPhase :: Yes ,
272
- } ,
273
- } ;
266
+ let mutbl = AutoBorrowMutability :: new ( * mutbl, AllowTwoPhase :: Yes ) ;
274
267
let autoref = Adjustment {
275
268
kind : Adjust :: Borrow ( AutoBorrow :: Ref ( * region, mutbl) ) ,
276
269
target : method. sig . inputs ( ) [ 0 ] ,
@@ -280,14 +273,10 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
280
273
}
281
274
if by_ref_binop {
282
275
if let ty:: Ref ( region, _, mutbl) = method. sig . inputs ( ) [ 1 ] . kind ( ) {
283
- let mutbl = match mutbl {
284
- hir:: Mutability :: Not => AutoBorrowMutability :: Not ,
285
- hir:: Mutability :: Mut => AutoBorrowMutability :: Mut {
286
- // Allow two-phase borrows for binops in initial deployment
287
- // since they desugar to methods
288
- allow_two_phase_borrow : AllowTwoPhase :: Yes ,
289
- } ,
290
- } ;
276
+ // Allow two-phase borrows for binops in initial deployment
277
+ // since they desugar to methods
278
+ let mutbl = AutoBorrowMutability :: new ( * mutbl, AllowTwoPhase :: Yes ) ;
279
+
291
280
let autoref = Adjustment {
292
281
kind : Adjust :: Borrow ( AutoBorrow :: Ref ( * region, mutbl) ) ,
293
282
target : method. sig . inputs ( ) [ 1 ] ,
0 commit comments