Skip to content

Commit 926359d

Browse files
committed
code cleanup
1 parent 950e94a commit 926359d

1 file changed

Lines changed: 10 additions & 6 deletions

File tree

compiler/rustc_borrowck/src/diagnostics/move_errors.rs

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -699,13 +699,17 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
699699
place: &place_desc,
700700
span,
701701
});
702-
} else if self.should_suggest_pattern_binding_instead(span, &binds_to)
703-
&& let Some(desugar_spans) = self.add_move_error_suggestions(err, &binds_to)
704-
{
705-
self.add_move_error_details(err, &binds_to, &desugar_spans);
706702
} else {
707-
self.add_borrow_suggestions(err, span, true);
708-
self.add_move_error_details(err, &binds_to, &[]);
703+
let pattern_binding_suggestion = self
704+
.should_suggest_pattern_binding_instead(span, &binds_to)
705+
.then(|| self.add_move_error_suggestions(err, &binds_to))
706+
.flatten();
707+
if let Some(desugar_spans) = pattern_binding_suggestion {
708+
self.add_move_error_details(err, &binds_to, &desugar_spans);
709+
} else {
710+
self.add_borrow_suggestions(err, span, true);
711+
self.add_move_error_details(err, &binds_to, &[]);
712+
}
709713
}
710714
}
711715
GroupedMoveError::MovesFromValue { mut binds_to, .. } => {

0 commit comments

Comments
 (0)