Problem
In #12779, cargo adds new packages to [workspace.members] automatically. This is great when workspace.member array alreay exists, but the format doesn't look good when workspace array is missing.
Steps
cargo new foo && cd foo
cargo add bar --lib
And you'll get the resulting TOML
workspace = { members = ["bar"] }
[package]
name = "foo"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
Possible Solution(s)
Don't add the new package to workspace.members if there is no existing workspace in Cargo.toml.
Notes
No response
Version
cargo 1.77.0-nightly (1ae631085 2024-01-17)
release: 1.77.0-nightly
commit-hash: 1ae631085f01c1a72d05df1ec81f3759a8360042
commit-date: 2024-01-17
Problem
In #12779, cargo adds new packages to [workspace.members] automatically. This is great when
workspace.memberarray alreay exists, but the format doesn't look good whenworkspacearray is missing.Steps
cargo new foo&& cd foocargo add bar --libAnd you'll get the resulting TOML
Possible Solution(s)
Don't add the new package to
workspace.membersif there is no existingworkspacein Cargo.toml.Notes
No response
Version