Skip to content

Command line option to only check (warning mode), not write any changes #1232

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

Closed
dhardy opened this issue Dec 2, 2016 · 3 comments
Closed

Comments

@dhardy
Copy link

dhardy commented Dec 2, 2016

We've started using rustfmt in Travis and are looking at pre-commit hooks. We use cargo fmt -- --write-mode=diff but really would like an option that doesn't try to make any changes, but does print warnings and exit with status 1 if the formatting is not clean.

@michaelsproul
Copy link

Found this issue when looking into #1977, and think it's probably out of date now with respect to rustfmt's current behaviour?

would like an option that doesn't try to make any changes

From the README:

diff: Will print a diff between the original files and formatted files to stdout. Will also exit with an error code if there are any differences.

This would appear to satisfy your suggestion, or am I misinterpreting, and you actually don't want any diff displayed at all..?

(p.s. Hi Diggory!)

@dhardy
Copy link
Author

dhardy commented Oct 23, 2017

Hi Michael!

Yes, I suppose that works well enough for CI. The only time it doesn't is when running rustfmt from the command line manually and not wanting a lot of output in the terminal.

But I don't have to use rustfmt any more so I don't particularly care ;)

@nrc nrc mentioned this issue Mar 12, 2018
@nrc
Copy link
Member

nrc commented Jun 24, 2018

We now have --check

@nrc nrc closed this as completed Jun 24, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants