@@ -262,7 +262,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
262
262
move_spans.var_span_label(&mut err, "move occurs due to use in closure");
263
263
264
264
self.explain_why_borrow_contains_point(context, borrow, None)
265
- .add_explanation_to_diagnostic(self.infcx.tcx, self.mir, &mut err, String::new() );
265
+ .add_explanation_to_diagnostic(self.infcx.tcx, self.mir, &mut err, "" );
266
266
err.buffer(&mut self.errors_buffer);
267
267
}
268
268
@@ -299,7 +299,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
299
299
});
300
300
301
301
self.explain_why_borrow_contains_point(context, borrow, None)
302
- .add_explanation_to_diagnostic(self.infcx.tcx, self.mir, &mut err, String::new() );
302
+ .add_explanation_to_diagnostic(self.infcx.tcx, self.mir, &mut err, "" );
303
303
err.buffer(&mut self.errors_buffer);
304
304
}
305
305
@@ -483,7 +483,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
483
483
}
484
484
485
485
self.explain_why_borrow_contains_point(context, issued_borrow, None)
486
- .add_explanation_to_diagnostic(self.infcx.tcx, self.mir, &mut err, first_borrow_desc.to_string() );
486
+ .add_explanation_to_diagnostic(self.infcx.tcx, self.mir, &mut err, first_borrow_desc);
487
487
488
488
err.buffer(&mut self.errors_buffer);
489
489
}
@@ -638,7 +638,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
638
638
639
639
if let BorrowExplanation::MustBeValidFor(..) = explanation {
640
640
} else {
641
- explanation.add_explanation_to_diagnostic(self.infcx.tcx, self.mir, &mut err, String::new() );
641
+ explanation.add_explanation_to_diagnostic(self.infcx.tcx, self.mir, &mut err, "" );
642
642
}
643
643
} else {
644
644
err.span_label(borrow_span, "borrowed value does not live long enough");
@@ -649,7 +649,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
649
649
650
650
borrow_spans.args_span_label(&mut err, "value captured here");
651
651
652
- explanation.add_explanation_to_diagnostic(self.infcx.tcx, self.mir, &mut err, String::new() );
652
+ explanation.add_explanation_to_diagnostic(self.infcx.tcx, self.mir, &mut err, "" );
653
653
}
654
654
655
655
err
@@ -709,7 +709,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
709
709
_ => {}
710
710
}
711
711
712
- explanation.add_explanation_to_diagnostic(self.infcx.tcx, self.mir, &mut err, String::new() );
712
+ explanation.add_explanation_to_diagnostic(self.infcx.tcx, self.mir, &mut err, "" );
713
713
714
714
err.buffer(&mut self.errors_buffer);
715
715
}
@@ -776,7 +776,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
776
776
}
777
777
_ => {}
778
778
}
779
- explanation.add_explanation_to_diagnostic(self.infcx.tcx, self.mir, &mut err, String::new() );
779
+ explanation.add_explanation_to_diagnostic(self.infcx.tcx, self.mir, &mut err, "" );
780
780
781
781
borrow_spans.args_span_label(&mut err, "value captured here");
782
782
@@ -913,7 +913,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
913
913
loan_spans.var_span_label(&mut err, "borrow occurs due to use in closure");
914
914
915
915
self.explain_why_borrow_contains_point(context, loan, None)
916
- .add_explanation_to_diagnostic(self.infcx.tcx, self.mir, &mut err, String::new() );
916
+ .add_explanation_to_diagnostic(self.infcx.tcx, self.mir, &mut err, "" );
917
917
918
918
err.buffer(&mut self.errors_buffer);
919
919
}
0 commit comments