-
Notifications
You must be signed in to change notification settings - Fork 946
Closed
Labels
bugPanic, non-idempotency, invalid code, etc.Panic, non-idempotency, invalid code, etc.good first issueIssues up for grabs, also good candidates for new rustfmt contributorsIssues up for grabs, also good candidates for new rustfmt contributors
Milestone
Description
Tested both in current stable & nightly
$ rustup run stable cargo fmt --version
<No output: bug?>
$ rustup run stable rustfmt --version
rustfmt 1.2.0-stable (09940a7 2019-03-27)
$ rustup run nightly cargo fmt --version
rustfmt 1.3.0-nightly (d334502 2019-06-09)
Steps to reproduce
cargo new cargo-fmt-test && cd cargo-fmt-test
cargo new --lib --name dependency-crate-name dependency-dir-name
- Add
dependency-crate-name = { path = "dependency-dir-name" }
to dependencies inCargo.toml
So, we have a path dependency with a directory name different than crate name. Looks like it is only broken if names differ.
Also, these steps do not create [workspace]
section in Cargo.toml
, so this is an implicit workspace or something. If [workspace]
is present, then it looks like cargo fmt
works correctly.
cargo fmt --all
$ cargo fmt --all -v
[bin (2018)] "/home/kuviman/Temp/cargo-fmt-test/src/main.rs"
rustfmt --edition 2018 /home/kuviman/Temp/cargo-fmt-test/src/main.rs
^This should format the dependency as well, but it does not
cargo fmt --package dependency-crate-name
$ cargo fmt --package dependency-crate-name
package `dependency-dir-name` is not a member of the workspace
usage: cargo fmt [options]
<...>
^ So, cargo-fmt
does not see the dependency as part of the workspace.
Also there is usage output for some reason
Default cargo subcommands do work (like cargo test --package dependency-crate-name
).
Metadata
Metadata
Assignees
Labels
bugPanic, non-idempotency, invalid code, etc.Panic, non-idempotency, invalid code, etc.good first issueIssues up for grabs, also good candidates for new rustfmt contributorsIssues up for grabs, also good candidates for new rustfmt contributors