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: Don't duplicate comments when editing TOML #13402

Merged
merged 1 commit into from
Feb 7, 2024
Merged

Conversation

epage
Copy link
Contributor

@epage epage commented Feb 5, 2024

What does this PR try to resolve?

toml_edit <0.22 has a bug that will cause

[lints]
rust.unsafe_op_in_unsafe_fn = "deny"

rust.explicit_outlives_requirements = "warn"
# rust.unused_crate_dependencies = "warn"

clippy.cast_lossless = "warn"
clippy.doc_markdown = "warn"
clippy.exhaustive_enums = "warn"

to be written out as

[lints]
rust.unsafe_op_in_unsafe_fn = "deny"
rust.explicit_outlives_requirements = "warn"
# rust.unused_crate_dependencies = "warn"

clippy.cast_lossless = "warn"
# rust.unused_crate_dependencies = "warn"

clippy.doc_markdown = "warn"
# rust.unused_crate_dependencies = "warn"

clippy.exhaustive_enums = "warn"

when it is parsed and then saved.

See toml-rs/toml#673

This affects any format-preserving edits we do, including:

  • cargo add
  • cargo remove
  • cargo init / cargo new editing the workspace

How should we test and review this PR?

I didn't add any tests as this is covered by toml_edits tests (we already don't cover a fraction of the edit preserving tests it has)

Additional information

`toml_edit` <0.22 has a bug that will cause
```toml
[lints]
rust.unsafe_op_in_unsafe_fn = "deny"

rust.explicit_outlives_requirements = "warn"

clippy.cast_lossless = "warn"
clippy.doc_markdown = "warn"
clippy.exhaustive_enums = "warn"
```
to be written out as
[lints]
rust.unsafe_op_in_unsafe_fn = "deny"
rust.explicit_outlives_requirements = "warn"

clippy.cast_lossless = "warn"

clippy.doc_markdown = "warn"

clippy.exhaustive_enums = "warn"
```
when it is parsed and then saved.

See toml-rs/toml#675

This affects any format-preserving edits we do, including:
- `cargo add`
- `cargo remove`
- `cargo init` / `cargo new` editing the workspace
@rustbot
Copy link
Collaborator

rustbot commented Feb 5, 2024

r? @weihanglo

(rustbot has picked a reviewer for you, use r? to override)

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Feb 5, 2024
@rustbot rustbot added the A-configuration Area: cargo config files and env vars label Feb 6, 2024
@weihanglo
Copy link
Member

Thanks!

@bors r+

@bors
Copy link
Collaborator

bors commented Feb 7, 2024

📌 Commit 12cf56a has been approved by weihanglo

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 Feb 7, 2024
@bors
Copy link
Collaborator

bors commented Feb 7, 2024

⌛ Testing commit 12cf56a with merge d7d48e4...

@bors
Copy link
Collaborator

bors commented Feb 7, 2024

☀️ Test successful - checks-actions
Approved by: weihanglo
Pushing d7d48e4 to master...

@bors bors merged commit d7d48e4 into rust-lang:master Feb 7, 2024
23 checks passed
@epage epage deleted the add branch February 7, 2024 19:50
bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 10, 2024
Update cargo

8 commits in ccc84ccec4b7340eb916aefda1cb3e2fe17d8e7b..fc1d58fd0531a57a6b942a14cdcdbcb82ece16f3
2024-02-07 15:37:49 +0000 to 2024-02-09 15:54:29 +0000
- docs(changelog): Clarify lints in virtual workspace error (rust-lang/cargo#13425)
- fix(compiler): Clarify Finished message (rust-lang/cargo#13422)
- fix(test-support): remove special case for `$message_type` (rust-lang/cargo#13424)
- chore(deps): update msrv (1 version) to v1.76.0 (rust-lang/cargo#13420)
- chore(bump-check): include rustfix and cargo-util-schemas (rust-lang/cargo#13421)
- chore: update to `jobserver` 0.1.28 (rust-lang/cargo#13419)
- feat: Add hint for adding members to workspace (rust-lang/cargo#13411)
- fix: Don't duplicate comments when editing TOML (rust-lang/cargo#13402)

r? weihanglo
bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 10, 2024
Update cargo

8 commits in ccc84ccec4b7340eb916aefda1cb3e2fe17d8e7b..fc1d58fd0531a57a6b942a14cdcdbcb82ece16f3
2024-02-07 15:37:49 +0000 to 2024-02-09 15:54:29 +0000
- docs(changelog): Clarify lints in virtual workspace error (rust-lang/cargo#13425)
- fix(compiler): Clarify Finished message (rust-lang/cargo#13422)
- fix(test-support): remove special case for `$message_type` (rust-lang/cargo#13424)
- chore(deps): update msrv (1 version) to v1.76.0 (rust-lang/cargo#13420)
- chore(bump-check): include rustfix and cargo-util-schemas (rust-lang/cargo#13421)
- chore: update to `jobserver` 0.1.28 (rust-lang/cargo#13419)
- feat: Add hint for adding members to workspace (rust-lang/cargo#13411)
- fix: Don't duplicate comments when editing TOML (rust-lang/cargo#13402)

r? weihanglo
bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 10, 2024
Update cargo

8 commits in ccc84ccec4b7340eb916aefda1cb3e2fe17d8e7b..fc1d58fd0531a57a6b942a14cdcdbcb82ece16f3
2024-02-07 15:37:49 +0000 to 2024-02-09 15:54:29 +0000
- docs(changelog): Clarify lints in virtual workspace error (rust-lang/cargo#13425)
- fix(compiler): Clarify Finished message (rust-lang/cargo#13422)
- fix(test-support): remove special case for `$message_type` (rust-lang/cargo#13424)
- chore(deps): update msrv (1 version) to v1.76.0 (rust-lang/cargo#13420)
- chore(bump-check): include rustfix and cargo-util-schemas (rust-lang/cargo#13421)
- chore: update to `jobserver` 0.1.28 (rust-lang/cargo#13419)
- feat: Add hint for adding members to workspace (rust-lang/cargo#13411)
- fix: Don't duplicate comments when editing TOML (rust-lang/cargo#13402)

r? weihanglo
bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 13, 2024
Update cargo

8 commits in ccc84ccec4b7340eb916aefda1cb3e2fe17d8e7b..fc1d58fd0531a57a6b942a14cdcdbcb82ece16f3
2024-02-07 15:37:49 +0000 to 2024-02-09 15:54:29 +0000
- docs(changelog): Clarify lints in virtual workspace error (rust-lang/cargo#13425)
- fix(compiler): Clarify Finished message (rust-lang/cargo#13422)
- fix(test-support): remove special case for `$message_type` (rust-lang/cargo#13424)
- chore(deps): update msrv (1 version) to v1.76.0 (rust-lang/cargo#13420)
- chore(bump-check): include rustfix and cargo-util-schemas (rust-lang/cargo#13421)
- chore: update to `jobserver` 0.1.28 (rust-lang/cargo#13419)
- feat: Add hint for adding members to workspace (rust-lang/cargo#13411)
- fix: Don't duplicate comments when editing TOML (rust-lang/cargo#13402)

r? weihanglo
@rustbot rustbot added this to the 1.78.0 milestone Feb 13, 2024
RalfJung pushed a commit to RalfJung/miri that referenced this pull request Feb 14, 2024
Update cargo

8 commits in ccc84ccec4b7340eb916aefda1cb3e2fe17d8e7b..fc1d58fd0531a57a6b942a14cdcdbcb82ece16f3
2024-02-07 15:37:49 +0000 to 2024-02-09 15:54:29 +0000
- docs(changelog): Clarify lints in virtual workspace error (rust-lang/cargo#13425)
- fix(compiler): Clarify Finished message (rust-lang/cargo#13422)
- fix(test-support): remove special case for `$message_type` (rust-lang/cargo#13424)
- chore(deps): update msrv (1 version) to v1.76.0 (rust-lang/cargo#13420)
- chore(bump-check): include rustfix and cargo-util-schemas (rust-lang/cargo#13421)
- chore: update to `jobserver` 0.1.28 (rust-lang/cargo#13419)
- feat: Add hint for adding members to workspace (rust-lang/cargo#13411)
- fix: Don't duplicate comments when editing TOML (rust-lang/cargo#13402)

r? weihanglo
lnicola pushed a commit to lnicola/rust-analyzer that referenced this pull request Apr 7, 2024
Update cargo

8 commits in ccc84ccec4b7340eb916aefda1cb3e2fe17d8e7b..fc1d58fd0531a57a6b942a14cdcdbcb82ece16f3
2024-02-07 15:37:49 +0000 to 2024-02-09 15:54:29 +0000
- docs(changelog): Clarify lints in virtual workspace error (rust-lang/cargo#13425)
- fix(compiler): Clarify Finished message (rust-lang/cargo#13422)
- fix(test-support): remove special case for `$message_type` (rust-lang/cargo#13424)
- chore(deps): update msrv (1 version) to v1.76.0 (rust-lang/cargo#13420)
- chore(bump-check): include rustfix and cargo-util-schemas (rust-lang/cargo#13421)
- chore: update to `jobserver` 0.1.28 (rust-lang/cargo#13419)
- feat: Add hint for adding members to workspace (rust-lang/cargo#13411)
- fix: Don't duplicate comments when editing TOML (rust-lang/cargo#13402)

r? weihanglo
RalfJung pushed a commit to RalfJung/rust-analyzer that referenced this pull request Apr 27, 2024
Update cargo

8 commits in ccc84ccec4b7340eb916aefda1cb3e2fe17d8e7b..fc1d58fd0531a57a6b942a14cdcdbcb82ece16f3
2024-02-07 15:37:49 +0000 to 2024-02-09 15:54:29 +0000
- docs(changelog): Clarify lints in virtual workspace error (rust-lang/cargo#13425)
- fix(compiler): Clarify Finished message (rust-lang/cargo#13422)
- fix(test-support): remove special case for `$message_type` (rust-lang/cargo#13424)
- chore(deps): update msrv (1 version) to v1.76.0 (rust-lang/cargo#13420)
- chore(bump-check): include rustfix and cargo-util-schemas (rust-lang/cargo#13421)
- chore: update to `jobserver` 0.1.28 (rust-lang/cargo#13419)
- feat: Add hint for adding members to workspace (rust-lang/cargo#13411)
- fix: Don't duplicate comments when editing TOML (rust-lang/cargo#13402)

r? weihanglo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-configuration Area: cargo config files and env vars 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