You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Running cargo add <EXISTING_DEP> causes the preceding comments to be deleted in Cargo.toml.
Steps
Create a new project with cargo new
Add the following to Cargo.toml:
[dependencies]
# Duis aliqua ullamco incididunt cupidatat Lorem est consequat nostrud mollit veniam fugiat.# Magna elit anim officia reprehenderit tempor exercitation in do voluptate cillum sunt deserunt duis est.chrono = "0.4.35"# Enim dolor veniam ipsum pariatur ullamco laborum veniam cillum dolore aliqua in officia.# Proident esse cillum mollit adipisicing culpa ad labore labore.serde = "1.0.197"# Tempor sunt duis labore dolore consequat labore ad.# Ipsum eu do amet excepteur sint nisi officia ullamco occaecat eu commodo amet veniam.
Run cargo add chrono/serde (in practise the likely reason you do this is to specify additional features, but that's not necessary for a MRE)
Observe that the two lines of preceding comments are deleted
A case the tests showed but isn't covered here is when a `[features]`
table is created, the dependencies-end comment gets attached to that,
e.g. see cargo_add/overwrite_optional
Fixesrust-lang#13645
fix(add): Preserve comments when updating simple deps
### What does this PR try to resolve?
Fixes#13645
### How should we test and review this PR?
A case the tests showed but isn't covered here is when a `[features]`
table is created, the dependencies-end comment gets attached to that,
e.g. see cargo_add/overwrite_optional
### Additional information
Problem
Running
cargo add <EXISTING_DEP>
causes the preceding comments to be deleted inCargo.toml
.Steps
cargo new
Cargo.toml
:cargo add chrono/serde
(in practise the likely reason you do this is to specify additional features, but that's not necessary for a MRE)Possible Solution(s)
No response
Notes
No response
Version
The text was updated successfully, but these errors were encountered: