1
Fork 0

Suggest the right help message for as_ref

This commit is contained in:
yukang 2022-08-20 09:43:37 +08:00
parent 1603a70f82
commit 3de74f7e2b
3 changed files with 57 additions and 1 deletions

View file

@ -2078,7 +2078,8 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
diag.span_suggestion(
span,
*msg,
format!("{}.as_ref()", snippet),
// HACK: fix issue# 100605, suggesting convert from &Option<T> to Option<&T>, remove the extra `&`
format!("{}.as_ref()", snippet.trim_start_matches('&')),
Applicability::MachineApplicable,
);
}