1
Fork 0

Use chaining in DiagnosticBuilder construction.

To avoid the use of a mutable local variable, and because it reads more
nicely.
This commit is contained in:
Nicholas Nethercote 2024-01-03 16:00:29 +11:00
parent b1b9278851
commit 589591efde
22 changed files with 223 additions and 369 deletions

View file

@ -2218,15 +2218,12 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
drop_span, borrow_span
);
let mut err = self.thread_local_value_does_not_live_long_enough(borrow_span);
err.span_label(
borrow_span,
"thread-local variables cannot be borrowed beyond the end of the function",
);
err.span_label(drop_span, "end of enclosing function is here");
err
self.thread_local_value_does_not_live_long_enough(borrow_span)
.span_label_mv(
borrow_span,
"thread-local variables cannot be borrowed beyond the end of the function",
)
.span_label_mv(drop_span, "end of enclosing function is here")
}
#[instrument(level = "debug", skip(self))]