cargo-sort icon indicating copy to clipboard operation
cargo-sort copied to clipboard

Should the pre-commit hook call `cargo-sort` with `--workspace`?

Open jwodder opened this issue 1 month ago • 1 comments

If cargo-sort (without arguments) is run in a workspace, the -w/--workspace option needs to be passed in order to sort the Cargo.toml files for all packages; in particular, users of the cargo-sort pre-commit hook currently have to add args: ["--workspace"] to their pre-commit config in order to get the behavior that I am sure 99% of users expect. On the other hand, in a non-workspace, adding the --workspace option does not seem to produce a change in behavior or any adverse effects. It would thus seem to make things all around more convenient if args: ["--workspace"] were added to .pre-commit-hooks.yaml — or is there some reason not to do this?

jwodder avatar Nov 16 '25 23:11 jwodder

Makes sense to me!

thomaseizinger avatar Nov 20 '25 07:11 thomaseizinger