-
Notifications
You must be signed in to change notification settings - Fork 926
bin: Add a very simple rustfmt-format-diff. #1842
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome, thank you! This looks great. Only comment about the code is about using logging. Could you file a tracking issue for things you think are missing for making this a 'complete' feature please?
src/bin/rustfmt-format-diff.rs
Outdated
verbose: bool, | ||
) -> Result<(), FormatDiffError> { | ||
if files.is_empty() || ranges.is_empty() { | ||
if verbose { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you use logging (debug!
or info!
) rather than if verbose
here and below?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, I was following the format cargo-fmt
was using, but will do.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done :)
This patch introduces a super-simple format-diff tool, that allows you to do: ``` git diff | rustfmt-format-diff -p 1 ``` To format your current changes. For now it doesn't accept too much customisation, and it basically calls rustfmt with the default configuration, but more customisation can be added in the future if needed.
4238baa
to
068bcad
Compare
Awesome, thank you! |
Is there a reason why this is a seperate binary, rather than a |
This patch introduces a super-simple format-diff tool, that allows you to do:
To format your current changes.
For now it doesn't accept too much customisation, and it basically calls rustfmt
with the default configuration, but more customisation can be added in the
future if needed.