1
Fork 0

Rollup merge of #87453 - ibraheemdev:i-68697, r=wesleywiser

Suggest removing unnecessary &mut as help message

Closes #68697
This commit is contained in:
Yuki Okushi 2021-07-28 18:28:17 +09:00 committed by GitHub
commit 954137ea0e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 46 additions and 24 deletions

View file

@ -242,7 +242,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
@ -324,7 +329,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] }