Skip to content

Commit 20a1315

Browse files
Update compiler/rustc_mir/src/borrow_check/diagnostics/explain_borrow.rs
Co-authored-by: Niko Matsakis <niko@alum.mit.edu>
1 parent 25beade commit 20a1315

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ impl BorrowExplanation {
112112
LaterUseKind::Other => "borrow used here, in later iteration of loop",
113113
};
114114
// We can use `var_or_use_span` if either `path_span` is not present, or both spans are the same
115-
if path_span.map_or(true, |path_span| path_span == var_or_use_span) {
115+
if path_span.map(|path_span| path_span == var_or_use_span).unwrap_or(true) {
116116
err.span_label(var_or_use_span, format!("{}{}", borrow_desc, message));
117117
} else {
118118
// path_span must be `Some` as otherwise the if condition is true

0 commit comments

Comments
 (0)