-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
cargo-fix: what kind of things can be fixed? #5846
Comments
Thanks for the report! The In that sense what needs to happen here is that the compiler needs to be updated and audited to have machine applicable suggestions in the situations you linked above, and once that's done it should be good to go to fixup the lints automatically! |
(↑ got scooped while I was drafting this comment, posting my version anyway because the links may be useful) Under the hood, Making The snake-case-name example is much more awkward, because you'd have to replace all appearances of the variable with the new name. We don't yet have structured suggestions for unused imports, but that's another case of "no one's gotten around to coding it yet" rather than any fundamental technical barrier. |
great answers, thank you both! |
Andrew Chin recently pointed out (rust-lang/cargo#5846) that it's surprising that `cargo fix` (now shipping with Cargo itself!) doesn't fix very common lint warnings, which is as good of a reminder as any that we should finish rust-lang#50723.
…ebank App-lint-cability @eminence recently pointed out (rust-lang/cargo#5846) that it's surprising that `cargo fix` (now shipping with Cargo itself!) doesn't fix very common lint warnings, which is as good of a reminder as any that we should finish rust-lang#50723. (Previously, we did this on the librustc and libsyntax crates in rust-lang#50724. I filed rust-lang/this-week-in-rust#685 in hopes of recruiting new contributors to do the rest.) r? @estebank
Maybe this is something that cargo-fix already accounts for, but I can imagine code suggestions for unused imports being overly verbose when using rustc as a human. Sometimes when doing refactoring you can end up with a lot of unused imports. When rustc gets code suggestions for unused imports, are those opt-in for automated tools like cargo-fix? Edit: Found rust-lang/rust#50723 which seems to discuss an |
@rphmeier Thanks for commenting! The suggestions for unused-imports were implemented by @pietroalbini in rust-lang/rust#56645, but actual rustfixability is blocked on rust-lang/rust#53934, which is blocked on me finding a free weekend day to finish researching the potential impacts on RLS &c.. We'll get there soon, I promise!! |
Thanks Zack, that's helpful! |
@zackmdavis Is there an issue to track rustfixability of unused imports? |
rust-lang/rust#47888? (Sorry, it looks like this still (!) points to being blocked on rust-lang/rust#53934, which I had done research on and genuinely intended to write an adequate solution, before life events pulled me away from compiler development for many, many months and I lost all my context; if anyone wants to pick it up, I can respond to questions.) |
I'm trying out cargo fix to see what kind of stuff it can fix, and I'm a little surprised that it doesn't fix some trivial stuff that looks easy to handle. Some examples:
Do you expect that
cargo fix
will eventually be able to make these types of fixes automatically?The text was updated successfully, but these errors were encountered: