Skip to content

Commit 3770cf7

Browse files
Improve suggestion to rename type starting with underscore to make it more obvious what is actually suggested
1 parent 632d26a commit 3770cf7

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

compiler/rustc_resolve/src/diagnostics.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -1571,9 +1571,10 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
15711571
{
15721572
// When the suggested binding change would be from `x` to `_x`, suggest changing the
15731573
// original binding definition instead. (#60164)
1574-
(span, snippet, ", consider changing it")
1574+
let post = format!(", consider renaming `{}` into `{snippet}`", suggestion.candidate);
1575+
(span, snippet, post)
15751576
} else {
1576-
(span, suggestion.candidate.to_string(), "")
1577+
(span, suggestion.candidate.to_string(), String::new())
15771578
};
15781579
let msg = match suggestion.target {
15791580
SuggestionTarget::SimilarlyNamed => format!(

0 commit comments

Comments
 (0)