about summary refs log tree commit diff
diff options
context:
space:
mode:
authorChrisPardy <chrispardy36@gmail.com>2021-04-28 21:32:01 -0400
committerChris Pardy <chrispardy36@gmail.com>2021-05-01 19:01:06 -0400
commit20a1315cbbf38057898a7559376c872ef224a17b (patch)
tree1e83d568bf62983ebb13552540e2bb69b4e32b93
parent25beade8dfc7943130be503a5e21ca8851d5992b (diff)
downloadrust-20a1315cbbf38057898a7559376c872ef224a17b.tar.gz
rust-20a1315cbbf38057898a7559376c872ef224a17b.zip
Update compiler/rustc_mir/src/borrow_check/diagnostics/explain_borrow.rs
Co-authored-by: Niko Matsakis <niko@alum.mit.edu>
-rw-r--r--compiler/rustc_mir/src/borrow_check/diagnostics/explain_borrow.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/rustc_mir/src/borrow_check/diagnostics/explain_borrow.rs b/compiler/rustc_mir/src/borrow_check/diagnostics/explain_borrow.rs
index 0e126551142..49e59f6612f 100644
--- a/compiler/rustc_mir/src/borrow_check/diagnostics/explain_borrow.rs
+++ b/compiler/rustc_mir/src/borrow_check/diagnostics/explain_borrow.rs
@@ -112,7 +112,7 @@ impl BorrowExplanation {
                     LaterUseKind::Other => "borrow used here, in later iteration of loop",
                 };
                 // We can use `var_or_use_span` if either `path_span` is not present, or both spans are the same
-                if path_span.map_or(true, |path_span| path_span == var_or_use_span) {
+                if path_span.map(|path_span| path_span == var_or_use_span).unwrap_or(true) {
                     err.span_label(var_or_use_span, format!("{}{}", borrow_desc, message));
                 } else {
                     // path_span must be `Some` as otherwise the if condition is true