Improve suggestion to rename type starting with underscore to make it more obvious what is actually suggested

This commit is contained in:
Guillaume Gomez 2024-02-29 12:06:51 +01:00
parent 632d26aeff
commit 3770cf7abf

View File

@ -1571,9 +1571,10 @@ pub(crate) fn add_typo_suggestion(
{
// When the suggested binding change would be from `x` to `_x`, suggest changing the
// original binding definition instead. (#60164)
(span, snippet, ", consider changing it")
let post = format!(", consider renaming `{}` into `{snippet}`", suggestion.candidate);
(span, snippet, post)
} else {
(span, suggestion.candidate.to_string(), "")
(span, suggestion.candidate.to_string(), String::new())
};
let msg = match suggestion.target {
SuggestionTarget::SimilarlyNamed => format!(