1
Fork 0

suggest removing unnecessary \&mut as help message

This commit is contained in:
ibraheemdev 2021-07-25 10:23:48 -04:00
parent e1d49aaad4
commit e8238a78df
15 changed files with 47 additions and 37 deletions

View file

@ -240,7 +240,12 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
.unwrap_or(false) =>
{
err.span_label(span, format!("cannot {ACT}", ACT = act));
err.span_label(span, "try removing `&mut` here");
err.span_suggestion(
span,
"try removing `&mut` here",
String::new(),
Applicability::MaybeIncorrect,
);
}
// We want to suggest users use `let mut` for local (user
@ -322,7 +327,12 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
} =>
{
err.span_label(span, format!("cannot {ACT}", ACT = act));
err.span_label(span, "try removing `&mut` here");
err.span_suggestion(
span,
"try removing `&mut` here",
String::new(),
Applicability::MaybeIncorrect,
);
}
PlaceRef { local, projection: [ProjectionElem::Deref] }