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

fix(cargo_new): format members list of workspace in Cargo.toml #15085

Conversation

detoxifiedplant
Copy link

What does this PR try to resolve?

Fixes #15084
formats members list in workspace of Cargo.toml.

How should we test and review this PR?

Steps

  1. mkdir work_space
  2. cd work_space
  3. echo "[workspace]" > Cargo.toml
  4. cargo new crates/lib_core
  5. cargo new crates/lib_auth

Current Output:

[workspace]
members = [ "crates/lib_auth","crates/lib_core"]

Fixed Output:

[workspace]
members = ["crates/lib_auth", "crates/lib_core"]

can write tests if required.

Thank You

@rustbot
Copy link
Collaborator

rustbot commented Jan 20, 2025

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @weihanglo (or someone else) some time within the next two weeks.

Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (S-waiting-on-review and S-waiting-on-author) stays updated, invoking these commands when appropriate:

  • @rustbot author: the review is finished, PR author should check the comments and take action accordingly
  • @rustbot review: the author is ready for a review, this PR will be queued again in the reviewer's queue

@rustbot rustbot added Command-new S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jan 20, 2025
@@ -999,6 +999,7 @@ fn update_manifest_with_new_member(
if was_sorted {
members.sort_by(|lhs, rhs| lhs.as_str().cmp(&rhs.as_str()));
}
members.fmt();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On the surface, this looks like this solves the problem but it removes any user formatting, like comments.

See #11743 for an example of where using fmt has a negative impact.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@epage yes, it removes the comments and user formatting.
closing the PR.

Thank You for your quick insight.

@epage
Copy link
Contributor

epage commented Jan 20, 2025

Per our contributing guide, we ask that features be marked as S-accepted before moving on to PRs.

@epage epage marked this pull request as draft January 20, 2025 17:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Command-new S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Format members Array of Cargo.toml in workspace
4 participants