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

test(add): Ensure comments are preserved #10849

Merged
merged 1 commit into from
Jul 13, 2022
Merged

Conversation

epage
Copy link
Contributor

@epage epage commented Jul 11, 2022

A comment on killercup/cargo-edit#15 had me worried that cargo add was
deleting comments now. It appears that isn't the case for inline
tables.

Standard tables however do delete comments. The work to make sure they
don't conflicts with another need. When changing the source, we delete
the old source fields and append the new which can cause some formatting
to be carried over unnecessarily.

For example, what would normally look like

cargo-list-test-fixture-dependency = { optional = true, path = "../dependency", version = "0.0.0" }

When fixed to preserve comments with my naive solution looks like

cargo-list-test-fixture-dependency = { optional = true , path = "../dependency", version = "0.0.0" }

Note that optional = true used to be last, so space separating it and
} was kept, now separating it and ,.

More work will be needed to get this into an ideal state but we can at
least have confidence with inline tables for now.

@rust-highfive
Copy link

r? @ehuss

(rust-highfive has picked a reviewer for you, use r? to override)

@ehuss
Copy link
Contributor

ehuss commented Jul 13, 2022

A comment on killercup/cargo-edit#15 had me worried that `cargo add` was
deleting comments now.  It appears that isn't the case for inline
tables.

Standard tables however do delete comments.  The work to make sure they
don't conflicts with another need.  When changing the source, we delete
the old source fields and append the new which can cause some formatting
to be carried over unnecessarily.

For example, what would normally look like
```toml
cargo-list-test-fixture-dependency = { optional = true, path = "../dependency", version = "0.0.0" }
```
When fixed to preserve comments with my naive solution looks like
```toml
cargo-list-test-fixture-dependency = { optional = true , path = "../dependency", version = "0.0.0" }
```
Note that `optional = true` used to be last, so space separating it and
`}` was kept, now separating it and `,`.

More work will be needed to get this into an ideal state but we can at
least have confidence with inline tables for now.
@epage epage force-pushed the inline branch 2 times, most recently from 664c203 to b78f918 Compare July 13, 2022 18:38
epage added a commit to epage/cargo that referenced this pull request Jul 13, 2022
@epage
Copy link
Contributor Author

epage commented Jul 13, 2022

Thanks! Missed that when splitting this out of another branch . Its fixed now.

@ehuss
Copy link
Contributor

ehuss commented Jul 13, 2022

@bors r+

@bors
Copy link
Contributor

bors commented Jul 13, 2022

📌 Commit b78f918 has been approved by ehuss

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jul 13, 2022
@bors
Copy link
Contributor

bors commented Jul 13, 2022

⌛ Testing commit b78f918 with merge 44684e0...

@bors
Copy link
Contributor

bors commented Jul 13, 2022

☀️ Test successful - checks-actions
Approved by: ehuss
Pushing 44684e0 to master...

@bors bors merged commit 44684e0 into rust-lang:master Jul 13, 2022
@epage epage deleted the inline branch July 13, 2022 21:29
bors added a commit to rust-lang-ci/rust that referenced this pull request Jul 14, 2022
Update cargo

7 commits in b1dd22e668af5279e13a071ad4b17435bd6bfa4c..8827baaa781b37872134c1ba692a6f0aeb37890e
2022-07-09 14:48:50 +0000 to 2022-07-14 02:56:51 +0000
- Add a test for regressions in selecting the correct workspace root (rust-lang/cargo#10862)
- clarify profile used for 'cargo install --debug' (rust-lang/cargo#10861)
- servers should use 404 (rust-lang/cargo#10860)
- test(add): Ensure comments are preserved (rust-lang/cargo#10849)
- Fix nested workspace resolution (rust-lang/cargo#10846)
- Small tweaks to the future-incompat docs. (rust-lang/cargo#10856)
- Fixed extra period typo (rust-lang/cargo#10847)
@ehuss ehuss added this to the 1.64.0 milestone Jul 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants