-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Warn on use x as x;
#6444
Comments
I expected rustfmt to work, but for some reasons it doesn't seem to work. |
You are right, |
Hmm, that's weird, it didn't work on rustc (it must not, since rustfmt is enforced by tidy). I guess this should be a rustfmt bug report, then? |
I would say so, if the |
Sounds good, thanks for the help debugging! I opened rust-lang/rustfmt#4594 instead. |
I was tinkering on this today. Was going to be my first Rust PR but I hit a wall on it, curious if I could get some feedback if I was even on the right track?
Still a novice at Rust though so I'm probably missing out on the most idiomatic path. If anyone would be willing to give some pointers I'd appreciate it to carry over to my next issue on here I try to tackle.
|
Hey @criminosis, thanks for your interest in improving Clippy! I'm sorry this was not actionable in Clippy in the end. I hope that at least it helped you to get acquainted with the code :) In this particular case, I think it would have been simpler to use an early lint pass instead of a late one, since you don't need name resolution, type information, etc. here. Also, I'm not sure but I would say that using a late lint pass the information we need may not be there anymore! Looking at how rustfmt seems to do it, if you use |
Hey @ebroto ! Yeah I was thinking I didn't need to use late lint towards the end but didn't end up getting that far. I'll check out |
What it does
Warns when you rename an import to the original name. This is useless; you can just
use
it directly.Categories (optional)
complexity
orstyle
maybe? It's definitely 'something simple but in a complex way', but I know a lot of people withallow(clippy::complexity)
which I would prefer not happen.What is the advantage of the recommended code over the original code
Drawbacks
None.
Example
https://github.com/rust-lang/rust/blob/c3ed6681ff8d446e68ce272be4bf66f4145f6e29/compiler/rustc_data_structures/src/sync.rs#L224
Could be written as:
The text was updated successfully, but these errors were encountered: