-
Notifications
You must be signed in to change notification settings - Fork 12.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Suggest changing _x
to x
instead of a use of x
to _x
#60164
Comments
I feel we should have a counterpart to the unused lint that checks for variables that are used but use the unused bar convention. That wouldn't be useful for the case presented here where you're using an unused bar for the first time, but seems like a reasonable addition. |
Such a lint is problematic within macros or other compiler-expanded code, since it's a common pattern to work around not knowing if there are any uses by naming the variables appropriately (for an example look at the |
@oli-obk I agree but I'm pretty sure that most lints should ignore code with spans in macro context already. |
Hi, I'd like to work on this! |
@xldenis sorry for not responding earlier. I only have very broad instructions right now, but don't hesitate to ask here or on the
|
Hi @oli-obk I've already done most of that :) I think I'll have a working PR next week. |
@saleemjaffer sure. Just |
When encountering a binding that isn't found but has a typo suggestion for a binding with a leading underscore, suggest changing the binding definition instead of the use place. Fix rust-lang#60164.
When encountering a binding that isn't found but has a typo suggestion for a binding with a leading underscore, suggest changing the binding definition instead of the use place. Fix rust-lang#60164.
Typo suggestion to change bindings with leading underscore When encountering a binding that isn't found but has a typo suggestion for a binding with a leading underscore, suggest changing the binding definition instead of the use place. Fix rust-lang#60164.
Typo suggestion to change bindings with leading underscore When encountering a binding that isn't found but has a typo suggestion for a binding with a leading underscore, suggest changing the binding definition instead of the use place. Fix rust-lang#60164.
Typo suggestion to change bindings with leading underscore When encountering a binding that isn't found but has a typo suggestion for a binding with a leading underscore, suggest changing the binding definition instead of the use place. Fix rust-lang#60164.
Rollup merge of rust-lang#116961 - estebank:issue-60164, r=oli-obk Typo suggestion to change bindings with leading underscore When encountering a binding that isn't found but has a typo suggestion for a binding with a leading underscore, suggest changing the binding definition instead of the use place. Fix rust-lang#60164.
Variables can be marked as unused by prepending with an underscore. If at some point such a variable is used again, the compiler suggests to name the use
_x
, even though every single time I have encountered this, what I wanted is to change the definition of_x
tox
.(Playground)
Errors:
The text was updated successfully, but these errors were encountered: