Skip to content

Commit c9c04f7

Browse files
GuillaumeGomezstlankes
authored andcommitted
Improve suggestion to rename type starting with underscore to make it more obvious what is actually suggested
1 parent 99f2aeb commit c9c04f7

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

compiler/rustc_resolve/src/diagnostics.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1585,9 +1585,10 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
15851585
{
15861586
// When the suggested binding change would be from `x` to `_x`, suggest changing the
15871587
// original binding definition instead. (#60164)
1588-
(span, snippet, ", consider changing it")
1588+
let post = format!(", consider renaming `{}` into `{snippet}`", suggestion.candidate);
1589+
(span, snippet, post)
15891590
} else {
1590-
(span, suggestion.candidate.to_string(), "")
1591+
(span, suggestion.candidate.to_string(), String::new())
15911592
};
15921593
let msg = match suggestion.target {
15931594
SuggestionTarget::SimilarlyNamed => format!(

0 commit comments

Comments
 (0)