Skip to content

Support --all flag #1532

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
BusyJay opened this issue May 11, 2017 · 7 comments
Closed

Support --all flag #1532

BusyJay opened this issue May 11, 2017 · 7 comments

Comments

@BusyJay
Copy link
Contributor

BusyJay commented May 11, 2017

It will be nice if cargo fmt --all will format all the projects in workspace just like cargo test -all will run all the tests in workspace.

@jtojnar
Copy link

jtojnar commented Jun 15, 2017

Duplicate of #1244, which was already fixed.

@BusyJay
Copy link
Contributor Author

BusyJay commented Jun 15, 2017

Yes.

@BusyJay BusyJay closed this as completed Jun 15, 2017
@bjadamson
Copy link

I can't get this to work, running cargo fmt --all I get the following:

cargo fmt --all

Unrecognized option: 'all'.
usage: cargo fmt [options]

Options:
-h, --help show this message
-q, --quiet no output printed to stdout
-v, --verbose use verbose output

This utility formats all bin and lib files of the current crate using rustfmt. Arguments after -- are passed to rustfmt.

Maybe I'm perhaps using it wrong? I'm trying to run this from within the root directory of a cargo virtual workspace.
Here's the link to my Cargo.toml I'm working with, if that's useful:
https://github.com/bjadamson/gfx/blob/mod-support/Cargo.toml

@emilio
Copy link
Contributor

emilio commented Aug 13, 2017

You probably want cargo fmt -- --all, I think.

@bjadamson
Copy link

bjadamson commented Aug 15, 2017

Thank you @emilio I will give that a shot. Color me super surprised that's the syntax the cargo fmt team went with for this... I'm sure there's a good reason (;

@nrc
Copy link
Member

nrc commented Aug 15, 2017

I'm sure there's a good reason

I think it is because of Cargo, rather than rustfmt - arguments before the -- are passed to Cargo, arguments after the -- are passed to the plugin.

@BusyJay
Copy link
Contributor Author

BusyJay commented Aug 16, 2017

Are you using the latest version of rustfmt? I can run cargo fmt --all directly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants