提交 20a1315c 编写于 作者: C ChrisPardy 提交者: Chris Pardy

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

Co-authored-by: NNiko Matsakis <niko@alum.mit.edu>
上级 25beade8
......@@ -112,7 +112,7 @@ pub(in crate::borrow_check) fn add_explanation_to_diagnostic<'tcx>(
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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册