Skip to content
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

cargo fmt has --all option but not --workspace like other commands #9347

Closed
jplatte opened this issue Apr 11, 2021 · 4 comments
Closed

cargo fmt has --all option but not --workspace like other commands #9347

jplatte opened this issue Apr 11, 2021 · 4 comments
Labels
C-bug Category: bug

Comments

@jplatte
Copy link
Contributor

jplatte commented Apr 11, 2021

Problem

The --all option for cargo commands was soft-deprecated in favor of the --workspace option, which does the same thing. It seems like this same thing was not done for cargo fmt, which still only has --all as an option to run it on all workspace packages.

Steps

  1. run cargo fmt --workspace
  2. observe error: Found argument '--workspace' which wasn't expected, or isn't valid in this context

Possible Solution(s)

Introduce --workspace flag for cargo fmt.

Notes

Latest version I currently have installed is cargo 1.52.0-nightly (90691f2bf 2021-03-16), I can't update right now; sorry if this already got fixed.

@jplatte jplatte added the C-bug Category: bug label Apr 11, 2021
@weihanglo
Copy link
Member

cargo-fmt is bundled with rustfmt as a thin cargo subcommand. Maybe we can move this issue there.

https://github.com/rust-lang/rustfmt/blob/a9876e8/src/cargo-fmt/main.rs#L58-L60

@jplatte
Copy link
Contributor Author

jplatte commented Apr 12, 2021

Moving the issue requires somebody with high enough privileges on both repos, right? Or do you just mean close this issue and open a new one on rustfmt?

@weihanglo
Copy link
Member

I have no privileges neither 🙂. The latter is much more easier for us.

@jplatte
Copy link
Contributor Author

jplatte commented Apr 12, 2021

Turns out there were already several issues about it, and they got closed because cargo fmt already affects the entire workspace without any options. --all is for path-based deps outside the workspace, which seems like a weird feature but whatever.

For more info, see rust-lang/rustfmt#3911.

@jplatte jplatte closed this as completed Apr 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: bug
Projects
None yet
Development

No branches or pull requests

2 participants