mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-26 16:54:01 +00:00
7e5528fa55
Improve renaming suggestion for names with leading underscores Fixes #125650 Before: ``` error[E0425]: cannot find value `p` in this scope --> test.rs:2:13 | 2 | let _ = p; | ^ | help: a local variable with a similar name exists, consider renaming `_p` into `p` | 1 | fn a(p: i32) { | ~ ``` After: ``` error[E0425]: cannot find value `p` in this scope --> test.rs:2:13 | 1 | fn a(_p: i32) { | -- `_p` defined here 2 | let _ = p; | ^ | help: the leading underscore in `_p` marks it as unused, consider renaming it to `p` | 1 | fn a(p: i32) { | ~ ``` This change doesn't exactly conform to what was proposed in the issue: 1. I've kept the suggested code instead of solely replacing it with the label 2. I've removed the "...similar name exists..." message instead of relocating to the usage span 3. You could argue that it still isn't completely clear that the change is referring to the definition (not the usage), but I'm not sure how to do this without playing down the fact that the error was caused by the usage of an undefined name. |
||
---|---|---|
.. | ||
src | ||
Cargo.toml | ||
messages.ftl |