cargo fmt should support -p/--package, like most other cargo subcommands, so that one can run cargo fmt -p PACKAGE1 -p PACKAGE2 in a Cargo workspace with several packages.
And may be cargo fmt --all to act on all the workspace members defined in the Cargo.toml
This feature would be very useful to have as rustfmt is a must-have cargo plugin and not having support for workspaces is a major inconvenience.
I suspect this would be relatively easy to implement. The cargo fmt stuff is fairly self-contained (in https://github.com/rust-lang-nursery/rustfmt/blob/master/src/bin/cargo-fmt.rs) and IIUC, workspace support just comes down to specifying a different 'start file' for rustfmt.
If anyone wants to tackle this, I'd more than happy by answering questions or pointing towards parts of the system.
I am willing to implement this.
This has been fixed now 🎉
so that one can run
cargo fmt -p PACKAGE1 -p PACKAGE2in a Cargo workspace with several packages.
It is strange: $ cargo fmt -p package results
Invalid argument:
package.
usage: cargo fmt [options]
Several combinations revealed the only accepting form: cargo fmt -ppackage o_O
P.S. version 0.3.8-nightly (346238f4 2018-02-04)
Most helpful comment
And may be
cargo fmt --allto act on all the workspace members defined in theCargo.toml