Skip to content

cargo fmt with specified manifest-path does not work in workspaces with bin and lib packages #6517

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Open
narasamdya opened this issue Mar 21, 2025 · 1 comment · May be fixed by #6524
Open

Comments

@narasamdya
Copy link

Describe the bug

When a workspace has bin and lib packages, specifying a manifest path in the invocation of cargo fmt makes cargo fmt fail to find targets.

$ cargo fmt --check --manifest-path Cargo.toml
Failed to find targets
This utility formats all bin and lib files of the current crate using rustfmt.
...

To Reproduce

  1. mkdir workspace_dir && cd workspace_dir
  2. printf '[workspace]\nmembers = ["inner_bin", "inner_lib"]' >> Cargo.toml
  3. cargo new inner_bin
  4. cargo new inner_lib --lib
  5. cargo fmt --check --manifest-path Cargo.toml

Expected behavior

cargo fmt should check formatting in all packages in the workspace.

Meta

$ cargo fmt --version
rustfmt 1.8.0

rustfmt version: 1.8.0
From where did you install rustfmt?: msrustup
How do you run rustfmt: cargo fmt --check --manifest-path Cargo.toml

@narasamdya
Copy link
Author

May be related to this issue 4432

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

Successfully merging a pull request may close this issue.

1 participant