@@ -395,22 +395,18 @@ impl<'a, 'tcx> CheckLoanCtxt<'a, 'tcx> {
395
395
assert ! ( self . bccx. region_scope_tree. scopes_intersect( old_loan. kill_scope,
396
396
new_loan. kill_scope) ) ;
397
397
398
- let err_old_new = Result :: err ( self . report_error_if_loan_conflicts_with_restriction (
399
- old_loan, new_loan, old_loan, new_loan
400
- ) ) ;
401
- let err_new_old = Result :: err ( self . report_error_if_loan_conflicts_with_restriction (
402
- new_loan, old_loan, old_loan, new_loan
403
- ) ) ;
404
-
405
- if let Some ( mut err_old) = err_old_new {
406
- err_old. emit ( ) ;
407
- if let Some ( mut err_new) = err_new_old {
398
+ let err_old_new = self . report_error_if_loan_conflicts_with_restriction (
399
+ old_loan, new_loan, old_loan, new_loan) . err ( ) ;
400
+ let err_new_old = self . report_error_if_loan_conflicts_with_restriction (
401
+ new_loan, old_loan, old_loan, new_loan) . err ( ) ;
402
+
403
+ match ( err_old_new, err_new_old) {
404
+ ( Some ( mut err) , None ) | ( None , Some ( mut err) ) => err. emit ( ) ,
405
+ ( Some ( mut err_old) , Some ( mut err_new) ) => {
406
+ err_old. emit ( ) ;
408
407
err_new. cancel ( ) ;
409
408
}
410
- } else if let Some ( mut err_new) = err_new_old {
411
- err_new. emit ( ) ;
412
- } else {
413
- return true ;
409
+ ( None , None ) => return true ,
414
410
}
415
411
416
412
false
0 commit comments