-
Notifications
You must be signed in to change notification settings - Fork 9
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
Format changed code? #72
Comments
Hey @davidhewitt :) I think it would be a great idea, it has raised concerns in the fmt project rust-lang/rustfmt#1324 , and it seems like it would be a bit hard to do. Other trade offs would include running fmt only on the files that are part of a diff, or maybe try to work on a way to get the shortest part of the AST and apply rust fmt on it. I wonder if that would be possible, but it would definitely be a great thing to try to figure out! I would gladly try to work on the ast idea if someone could mentor me, I’m not really sure who I could refer to. |
Sorry, I am not working on Rustfmt anymore. If you comment on an issue on their repo, there should be somebody who can mentor you. Good luck! |
Hey and thanks for your reply, I’ll send a message over :) |
There might be a way to use an unstable feature to do it:
Let's try to play around with that :D |
It starts looking pretty good:
For now it only checks for formatting, but we can start working on a --fix command as soon as this gets merged. |
Awesome, many thanks for implementing this! |
Whoops, I'm going to reopen this ^^' For now |
might be able to revive this one soon : https://twitter.com/yaahc_/status/1250842702242910208?s=20 :D |
Hey @o0Ignition0o do you have any update on that issue? I'm still very interested |
Do you think it would be possible to add a flag/mode to format the changed code? This would be really helpful alongside clippy warnings to keep PRs high quality.
(A lot of projects would pick up a lot of changes that would be irrelevant to the PR if I run
cargo fmt
, so formatting just my diff would be great.)The text was updated successfully, but these errors were encountered: