Update compiler/rustc_mir/src/borrow_check/diagnostics/explain_borrow.rs

Co-authored-by: Niko Matsakis <niko@alum.mit.edu>
This commit is contained in:
ChrisPardy 2021-04-28 21:32:28 -04:00 committed by Chris Pardy
parent 20a1315cbb
commit e612f7abfc

View File

@ -119,7 +119,7 @@ impl BorrowExplanation {
let path_span = path_span.unwrap();
// path_span is only present in the case of closure capture
assert!(matches!(later_use_kind, LaterUseKind::ClosureCapture));
if !borrow_span.map_or(false, |sp| sp.overlaps(var_or_use_span)) {
if borrow_span.map(|sp| !sp.overlaps(var_or_use_span)).unwrap_or(true) {
let path_label = "used here by closure";
let capture_kind_label = message;
err.span_label(