Skip to content

Automatically inherit workspace fields when running cargo new #10870

Closed
@epage

Description

@epage

Problem

When I create a new workspace, cargo new populates some fields but leaves me to fill in the rest. If I run it within a workspace with workspace.package fields set, I most likely intend to inherit those in this new crate as well.

Proposed Solution

When cargo new is run, search up for a possible workspace. If one is found, check which workspace.package fields are set and then in the new package, set those fields to <field>.workspace = true.

Notes

See #10859

I don't think this is blocked on #6378 because cargo new in a workspace that uses globs in members will automatically pick up the new crate and doesn't need #6378 to take advantage of this.

Metadata

Metadata

Assignees

Labels

C-feature-requestCategory: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`Command-newE-mediumExperience: MediumS-acceptedStatus: Issue or feature is accepted, and has a team member available to help mentor or review

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions