diff --git a/src/cargo/util/toml_mut/dependency.rs b/src/cargo/util/toml_mut/dependency.rs index d9c24e6e986..5e8d686fdbd 100644 --- a/src/cargo/util/toml_mut/dependency.rs +++ b/src/cargo/util/toml_mut/dependency.rs @@ -474,9 +474,18 @@ impl Dependency { item: &mut toml_edit::Item, ) { if str_or_1_len_table(item) { - // Nothing to preserve - *item = self.to_toml(crate_root); - key.fmt(); + // Little to preserve + let mut new_item = self.to_toml(crate_root); + match (&item, &mut new_item) { + (toml_edit::Item::Value(old), toml_edit::Item::Value(new)) => { + *new.decor_mut() = old.decor().clone(); + } + (toml_edit::Item::Table(old), toml_edit::Item::Table(new)) => { + *new.decor_mut() = old.decor().clone(); + } + (_, _) => {} + } + *item = new_item; } else if let Some(table) = item.as_table_like_mut() { match &self.source { Some(Source::Registry(src)) => { diff --git a/tests/testsuite/cargo_add/overwrite_default_features/in/Cargo.toml b/tests/testsuite/cargo_add/overwrite_default_features/in/Cargo.toml index 5ea9426f0f3..ef0388448f7 100644 --- a/tests/testsuite/cargo_add/overwrite_default_features/in/Cargo.toml +++ b/tests/testsuite/cargo_add/overwrite_default_features/in/Cargo.toml @@ -6,5 +6,8 @@ version = "0.0.0" edition = "2015" [dependencies] -my-package1 = "99999.0.0" -my-package2 = "0.4.1" +# Before my-package1 +my-package1 = "99999.0.0" # After my-package1 +# Before my-package2 +my-package2 = "0.4.1" # After my-package2 +# End diff --git a/tests/testsuite/cargo_add/overwrite_default_features/out/Cargo.toml b/tests/testsuite/cargo_add/overwrite_default_features/out/Cargo.toml index 5ea9426f0f3..ef0388448f7 100644 --- a/tests/testsuite/cargo_add/overwrite_default_features/out/Cargo.toml +++ b/tests/testsuite/cargo_add/overwrite_default_features/out/Cargo.toml @@ -6,5 +6,8 @@ version = "0.0.0" edition = "2015" [dependencies] -my-package1 = "99999.0.0" -my-package2 = "0.4.1" +# Before my-package1 +my-package1 = "99999.0.0" # After my-package1 +# Before my-package2 +my-package2 = "0.4.1" # After my-package2 +# End diff --git a/tests/testsuite/cargo_add/overwrite_default_features_with_no_default_features/in/Cargo.toml b/tests/testsuite/cargo_add/overwrite_default_features_with_no_default_features/in/Cargo.toml index 09efb086861..dfe88d618ab 100644 --- a/tests/testsuite/cargo_add/overwrite_default_features_with_no_default_features/in/Cargo.toml +++ b/tests/testsuite/cargo_add/overwrite_default_features_with_no_default_features/in/Cargo.toml @@ -6,5 +6,8 @@ version = "0.0.0" edition = "2015" [dependencies] -my-package1 = { version = "99999.0.0", default-features = true } -my-package2 = { version = "0.4.1", default-features = true } +# Before my-package1 +my-package1 = { version = "99999.0.0", default-features = true } # After my-package1 +# Before my-package2 +my-package2 = { version = "0.4.1", default-features = true } # After my-package2 +# End diff --git a/tests/testsuite/cargo_add/overwrite_default_features_with_no_default_features/out/Cargo.toml b/tests/testsuite/cargo_add/overwrite_default_features_with_no_default_features/out/Cargo.toml index d84f2a432a2..9232bb6acc4 100644 --- a/tests/testsuite/cargo_add/overwrite_default_features_with_no_default_features/out/Cargo.toml +++ b/tests/testsuite/cargo_add/overwrite_default_features_with_no_default_features/out/Cargo.toml @@ -6,5 +6,8 @@ version = "0.0.0" edition = "2015" [dependencies] -my-package1 = { version = "99999.0.0", default-features = false } -my-package2 = { version = "0.4.1", default-features = false } +# Before my-package1 +my-package1 = { version = "99999.0.0", default-features = false } # After my-package1 +# Before my-package2 +my-package2 = { version = "0.4.1", default-features = false } # After my-package2 +# End diff --git a/tests/testsuite/cargo_add/overwrite_features/in/Cargo.toml b/tests/testsuite/cargo_add/overwrite_features/in/Cargo.toml index 3bef0b6678c..9a87a308906 100644 --- a/tests/testsuite/cargo_add/overwrite_features/in/Cargo.toml +++ b/tests/testsuite/cargo_add/overwrite_features/in/Cargo.toml @@ -6,4 +6,6 @@ version = "0.0.0" edition = "2015" [dependencies] -your-face = { version = "99999.0.0", features = ["eyes"] } +# Before your-face +your-face = { version = "99999.0.0", features = ["eyes"] } # After your-face +# End diff --git a/tests/testsuite/cargo_add/overwrite_features/out/Cargo.toml b/tests/testsuite/cargo_add/overwrite_features/out/Cargo.toml index 299aa8a6486..3743da6762f 100644 --- a/tests/testsuite/cargo_add/overwrite_features/out/Cargo.toml +++ b/tests/testsuite/cargo_add/overwrite_features/out/Cargo.toml @@ -6,4 +6,6 @@ version = "0.0.0" edition = "2015" [dependencies] -your-face = { version = "99999.0.0", features = ["eyes", "nose"] } +# Before your-face +your-face = { version = "99999.0.0", features = ["eyes", "nose"] } # After your-face +# End diff --git a/tests/testsuite/cargo_add/overwrite_inline_features/in/Cargo.toml b/tests/testsuite/cargo_add/overwrite_inline_features/in/Cargo.toml index 3bef0b6678c..9a87a308906 100644 --- a/tests/testsuite/cargo_add/overwrite_inline_features/in/Cargo.toml +++ b/tests/testsuite/cargo_add/overwrite_inline_features/in/Cargo.toml @@ -6,4 +6,6 @@ version = "0.0.0" edition = "2015" [dependencies] -your-face = { version = "99999.0.0", features = ["eyes"] } +# Before your-face +your-face = { version = "99999.0.0", features = ["eyes"] } # After your-face +# End diff --git a/tests/testsuite/cargo_add/overwrite_inline_features/out/Cargo.toml b/tests/testsuite/cargo_add/overwrite_inline_features/out/Cargo.toml index e7eb3977162..3e6bbc6f43f 100644 --- a/tests/testsuite/cargo_add/overwrite_inline_features/out/Cargo.toml +++ b/tests/testsuite/cargo_add/overwrite_inline_features/out/Cargo.toml @@ -7,4 +7,6 @@ edition = "2015" [dependencies] unrelateed-crate = "99999.0.0" -your-face = { version = "99999.0.0", features = ["eyes", "nose", "mouth", "ears"] } +# Before your-face +your-face = { version = "99999.0.0", features = ["eyes", "nose", "mouth", "ears"] } # After your-face +# End diff --git a/tests/testsuite/cargo_add/overwrite_name_dev_noop/in/Cargo.toml b/tests/testsuite/cargo_add/overwrite_name_dev_noop/in/Cargo.toml index e6a779dcd5d..b20674620d1 100644 --- a/tests/testsuite/cargo_add/overwrite_name_dev_noop/in/Cargo.toml +++ b/tests/testsuite/cargo_add/overwrite_name_dev_noop/in/Cargo.toml @@ -7,4 +7,6 @@ version = "0.0.0" edition = "2015" [dev-dependencies] -your-face = { version = "0.0.0", path = "dependency", default-features = false, features = ["nose", "mouth"], registry = "alternative" } +# Before your-face +your-face = { version = "0.0.0", path = "dependency", default-features = false, features = ["nose", "mouth"], registry = "alternative" } # After your-face +# End diff --git a/tests/testsuite/cargo_add/overwrite_name_dev_noop/out/Cargo.toml b/tests/testsuite/cargo_add/overwrite_name_dev_noop/out/Cargo.toml index e6a779dcd5d..b20674620d1 100644 --- a/tests/testsuite/cargo_add/overwrite_name_dev_noop/out/Cargo.toml +++ b/tests/testsuite/cargo_add/overwrite_name_dev_noop/out/Cargo.toml @@ -7,4 +7,6 @@ version = "0.0.0" edition = "2015" [dev-dependencies] -your-face = { version = "0.0.0", path = "dependency", default-features = false, features = ["nose", "mouth"], registry = "alternative" } +# Before your-face +your-face = { version = "0.0.0", path = "dependency", default-features = false, features = ["nose", "mouth"], registry = "alternative" } # After your-face +# End diff --git a/tests/testsuite/cargo_add/overwrite_name_noop/in/Cargo.toml b/tests/testsuite/cargo_add/overwrite_name_noop/in/Cargo.toml index 9f30383f000..01419e5d5e9 100644 --- a/tests/testsuite/cargo_add/overwrite_name_noop/in/Cargo.toml +++ b/tests/testsuite/cargo_add/overwrite_name_noop/in/Cargo.toml @@ -7,4 +7,6 @@ version = "0.0.0" edition = "2015" [dependencies] -your-face = { version = "0.0.0", path = "dependency", optional = true, default-features = false, features = ["nose", "mouth"], registry = "alternative" } +# Before your-face +your-face = { version = "0.0.0", path = "dependency", optional = true, default-features = false, features = ["nose", "mouth"], registry = "alternative" } # After your-face +# End diff --git a/tests/testsuite/cargo_add/overwrite_name_noop/out/Cargo.toml b/tests/testsuite/cargo_add/overwrite_name_noop/out/Cargo.toml index bef5158b9d6..9ef05e9c62f 100644 --- a/tests/testsuite/cargo_add/overwrite_name_noop/out/Cargo.toml +++ b/tests/testsuite/cargo_add/overwrite_name_noop/out/Cargo.toml @@ -7,7 +7,9 @@ version = "0.0.0" edition = "2015" [dependencies] -your-face = { version = "0.0.0", path = "dependency", optional = true, default-features = false, features = ["nose", "mouth"], registry = "alternative" } +# Before your-face +your-face = { version = "0.0.0", path = "dependency", optional = true, default-features = false, features = ["nose", "mouth"], registry = "alternative" } # After your-face [features] your-face = ["dep:your-face"] +# End diff --git a/tests/testsuite/cargo_add/overwrite_no_default_features/in/Cargo.toml b/tests/testsuite/cargo_add/overwrite_no_default_features/in/Cargo.toml index 5ea9426f0f3..ef0388448f7 100644 --- a/tests/testsuite/cargo_add/overwrite_no_default_features/in/Cargo.toml +++ b/tests/testsuite/cargo_add/overwrite_no_default_features/in/Cargo.toml @@ -6,5 +6,8 @@ version = "0.0.0" edition = "2015" [dependencies] -my-package1 = "99999.0.0" -my-package2 = "0.4.1" +# Before my-package1 +my-package1 = "99999.0.0" # After my-package1 +# Before my-package2 +my-package2 = "0.4.1" # After my-package2 +# End diff --git a/tests/testsuite/cargo_add/overwrite_no_default_features/out/Cargo.toml b/tests/testsuite/cargo_add/overwrite_no_default_features/out/Cargo.toml index d84f2a432a2..9232bb6acc4 100644 --- a/tests/testsuite/cargo_add/overwrite_no_default_features/out/Cargo.toml +++ b/tests/testsuite/cargo_add/overwrite_no_default_features/out/Cargo.toml @@ -6,5 +6,8 @@ version = "0.0.0" edition = "2015" [dependencies] -my-package1 = { version = "99999.0.0", default-features = false } -my-package2 = { version = "0.4.1", default-features = false } +# Before my-package1 +my-package1 = { version = "99999.0.0", default-features = false } # After my-package1 +# Before my-package2 +my-package2 = { version = "0.4.1", default-features = false } # After my-package2 +# End diff --git a/tests/testsuite/cargo_add/overwrite_no_default_features_with_default_features/in/Cargo.toml b/tests/testsuite/cargo_add/overwrite_no_default_features_with_default_features/in/Cargo.toml index d84f2a432a2..9232bb6acc4 100644 --- a/tests/testsuite/cargo_add/overwrite_no_default_features_with_default_features/in/Cargo.toml +++ b/tests/testsuite/cargo_add/overwrite_no_default_features_with_default_features/in/Cargo.toml @@ -6,5 +6,8 @@ version = "0.0.0" edition = "2015" [dependencies] -my-package1 = { version = "99999.0.0", default-features = false } -my-package2 = { version = "0.4.1", default-features = false } +# Before my-package1 +my-package1 = { version = "99999.0.0", default-features = false } # After my-package1 +# Before my-package2 +my-package2 = { version = "0.4.1", default-features = false } # After my-package2 +# End diff --git a/tests/testsuite/cargo_add/overwrite_no_default_features_with_default_features/out/Cargo.toml b/tests/testsuite/cargo_add/overwrite_no_default_features_with_default_features/out/Cargo.toml index 51deb2f8802..37fb9536214 100644 --- a/tests/testsuite/cargo_add/overwrite_no_default_features_with_default_features/out/Cargo.toml +++ b/tests/testsuite/cargo_add/overwrite_no_default_features_with_default_features/out/Cargo.toml @@ -6,5 +6,8 @@ version = "0.0.0" edition = "2015" [dependencies] -my-package1 = { version = "99999.0.0" } -my-package2 = { version = "0.4.1" } +# Before my-package1 +my-package1 = { version = "99999.0.0" } # After my-package1 +# Before my-package2 +my-package2 = { version = "0.4.1" } # After my-package2 +# End diff --git a/tests/testsuite/cargo_add/overwrite_no_optional/in/Cargo.toml b/tests/testsuite/cargo_add/overwrite_no_optional/in/Cargo.toml index c2949b6f230..68ee4c537fa 100644 --- a/tests/testsuite/cargo_add/overwrite_no_optional/in/Cargo.toml +++ b/tests/testsuite/cargo_add/overwrite_no_optional/in/Cargo.toml @@ -6,4 +6,6 @@ version = "0.0.0" edition = "2015" [dependencies] -my-package = "0.1.0" +# Before my-package +my-package = "0.1.0" # After my-package +# End diff --git a/tests/testsuite/cargo_add/overwrite_no_optional/out/Cargo.toml b/tests/testsuite/cargo_add/overwrite_no_optional/out/Cargo.toml index c2949b6f230..68ee4c537fa 100644 --- a/tests/testsuite/cargo_add/overwrite_no_optional/out/Cargo.toml +++ b/tests/testsuite/cargo_add/overwrite_no_optional/out/Cargo.toml @@ -6,4 +6,6 @@ version = "0.0.0" edition = "2015" [dependencies] -my-package = "0.1.0" +# Before my-package +my-package = "0.1.0" # After my-package +# End diff --git a/tests/testsuite/cargo_add/overwrite_no_optional_with_optional/in/Cargo.toml b/tests/testsuite/cargo_add/overwrite_no_optional_with_optional/in/Cargo.toml index b45d00bc7ca..4c7b6a3956c 100644 --- a/tests/testsuite/cargo_add/overwrite_no_optional_with_optional/in/Cargo.toml +++ b/tests/testsuite/cargo_add/overwrite_no_optional_with_optional/in/Cargo.toml @@ -6,4 +6,6 @@ version = "0.0.0" edition = "2015" [dependencies] -my-package = { version = "0.1.0", optional = false } +# Before my-package +my-package = { version = "0.1.0", optional = false } # After my-package +# End diff --git a/tests/testsuite/cargo_add/overwrite_no_optional_with_optional/out/Cargo.toml b/tests/testsuite/cargo_add/overwrite_no_optional_with_optional/out/Cargo.toml index 41474d83f4c..500c3a24cd3 100644 --- a/tests/testsuite/cargo_add/overwrite_no_optional_with_optional/out/Cargo.toml +++ b/tests/testsuite/cargo_add/overwrite_no_optional_with_optional/out/Cargo.toml @@ -6,7 +6,9 @@ version = "0.0.0" edition = "2015" [dependencies] -my-package = { version = "0.1.0", optional = true } +# Before my-package +my-package = { version = "0.1.0", optional = true } # After my-package [features] my-package = ["dep:my-package"] +# End diff --git a/tests/testsuite/cargo_add/overwrite_no_public/in/Cargo.toml b/tests/testsuite/cargo_add/overwrite_no_public/in/Cargo.toml index 62d53a42aff..746b18e682a 100644 --- a/tests/testsuite/cargo_add/overwrite_no_public/in/Cargo.toml +++ b/tests/testsuite/cargo_add/overwrite_no_public/in/Cargo.toml @@ -7,4 +7,6 @@ version = "0.0.0" edition = "2015" [dependencies] -my-package = "0.1.0" +# Before my-package +my-package = "0.1.0" # After my-package +# End diff --git a/tests/testsuite/cargo_add/overwrite_no_public/out/Cargo.toml b/tests/testsuite/cargo_add/overwrite_no_public/out/Cargo.toml index 62d53a42aff..746b18e682a 100644 --- a/tests/testsuite/cargo_add/overwrite_no_public/out/Cargo.toml +++ b/tests/testsuite/cargo_add/overwrite_no_public/out/Cargo.toml @@ -7,4 +7,6 @@ version = "0.0.0" edition = "2015" [dependencies] -my-package = "0.1.0" +# Before my-package +my-package = "0.1.0" # After my-package +# End diff --git a/tests/testsuite/cargo_add/overwrite_no_public_with_public/in/Cargo.toml b/tests/testsuite/cargo_add/overwrite_no_public_with_public/in/Cargo.toml index 5c91f58040c..f9f5006023e 100644 --- a/tests/testsuite/cargo_add/overwrite_no_public_with_public/in/Cargo.toml +++ b/tests/testsuite/cargo_add/overwrite_no_public_with_public/in/Cargo.toml @@ -7,4 +7,6 @@ version = "0.0.0" edition = "2015" [dependencies] -my-package = { version = "0.1.0", public = false } +# Before my-package +my-package = { version = "0.1.0", public = false } # After my-package +# End diff --git a/tests/testsuite/cargo_add/overwrite_no_public_with_public/out/Cargo.toml b/tests/testsuite/cargo_add/overwrite_no_public_with_public/out/Cargo.toml index 2cd8b8ddefb..97e1b42ca85 100644 --- a/tests/testsuite/cargo_add/overwrite_no_public_with_public/out/Cargo.toml +++ b/tests/testsuite/cargo_add/overwrite_no_public_with_public/out/Cargo.toml @@ -7,4 +7,6 @@ version = "0.0.0" edition = "2015" [dependencies] -my-package = { version = "0.1.0", public = true } +# Before my-package +my-package = { version = "0.1.0", public = true } # After my-package +# End diff --git a/tests/testsuite/cargo_add/overwrite_optional/in/Cargo.toml b/tests/testsuite/cargo_add/overwrite_optional/in/Cargo.toml index c2949b6f230..68ee4c537fa 100644 --- a/tests/testsuite/cargo_add/overwrite_optional/in/Cargo.toml +++ b/tests/testsuite/cargo_add/overwrite_optional/in/Cargo.toml @@ -6,4 +6,6 @@ version = "0.0.0" edition = "2015" [dependencies] -my-package = "0.1.0" +# Before my-package +my-package = "0.1.0" # After my-package +# End diff --git a/tests/testsuite/cargo_add/overwrite_optional/out/Cargo.toml b/tests/testsuite/cargo_add/overwrite_optional/out/Cargo.toml index 41474d83f4c..500c3a24cd3 100644 --- a/tests/testsuite/cargo_add/overwrite_optional/out/Cargo.toml +++ b/tests/testsuite/cargo_add/overwrite_optional/out/Cargo.toml @@ -6,7 +6,9 @@ version = "0.0.0" edition = "2015" [dependencies] -my-package = { version = "0.1.0", optional = true } +# Before my-package +my-package = { version = "0.1.0", optional = true } # After my-package [features] my-package = ["dep:my-package"] +# End diff --git a/tests/testsuite/cargo_add/overwrite_optional_with_no_optional/in/Cargo.toml b/tests/testsuite/cargo_add/overwrite_optional_with_no_optional/in/Cargo.toml index 4906114f837..eeaa225a963 100644 --- a/tests/testsuite/cargo_add/overwrite_optional_with_no_optional/in/Cargo.toml +++ b/tests/testsuite/cargo_add/overwrite_optional_with_no_optional/in/Cargo.toml @@ -10,4 +10,6 @@ default = ["your-face"] other = ["your-face/nose"] [dependencies] -your-face = { version = "99999.0.0", optional = true } +# Before your-face +your-face = { version = "99999.0.0", optional = true } # After your-face +# End diff --git a/tests/testsuite/cargo_add/overwrite_optional_with_no_optional/out/Cargo.toml b/tests/testsuite/cargo_add/overwrite_optional_with_no_optional/out/Cargo.toml index aa47e130c26..18d25e2dca9 100644 --- a/tests/testsuite/cargo_add/overwrite_optional_with_no_optional/out/Cargo.toml +++ b/tests/testsuite/cargo_add/overwrite_optional_with_no_optional/out/Cargo.toml @@ -10,4 +10,6 @@ default = [] other = ["your-face/nose"] [dependencies] -your-face = { version = "99999.0.0" } +# Before your-face +your-face = { version = "99999.0.0" } # After your-face +# End diff --git a/tests/testsuite/cargo_add/overwrite_optional_with_optional/in/Cargo.toml b/tests/testsuite/cargo_add/overwrite_optional_with_optional/in/Cargo.toml index 6450e5c1c4e..cd69a13b60a 100644 --- a/tests/testsuite/cargo_add/overwrite_optional_with_optional/in/Cargo.toml +++ b/tests/testsuite/cargo_add/overwrite_optional_with_optional/in/Cargo.toml @@ -6,7 +6,9 @@ version = "0.0.0" edition = "2015" [dependencies] -my-package1 = { version = "99999.0.0", optional = true } +# Before my-package1 +my-package1 = { version = "99999.0.0", optional = true } # After my-package1 +# End [features] default = ["dep:my-package1"] diff --git a/tests/testsuite/cargo_add/overwrite_optional_with_optional/out/Cargo.toml b/tests/testsuite/cargo_add/overwrite_optional_with_optional/out/Cargo.toml index 6450e5c1c4e..cd69a13b60a 100644 --- a/tests/testsuite/cargo_add/overwrite_optional_with_optional/out/Cargo.toml +++ b/tests/testsuite/cargo_add/overwrite_optional_with_optional/out/Cargo.toml @@ -6,7 +6,9 @@ version = "0.0.0" edition = "2015" [dependencies] -my-package1 = { version = "99999.0.0", optional = true } +# Before my-package1 +my-package1 = { version = "99999.0.0", optional = true } # After my-package1 +# End [features] default = ["dep:my-package1"] diff --git a/tests/testsuite/cargo_add/overwrite_path_noop/in/Cargo.toml b/tests/testsuite/cargo_add/overwrite_path_noop/in/Cargo.toml index 9f30383f000..76204788f12 100644 --- a/tests/testsuite/cargo_add/overwrite_path_noop/in/Cargo.toml +++ b/tests/testsuite/cargo_add/overwrite_path_noop/in/Cargo.toml @@ -7,4 +7,6 @@ version = "0.0.0" edition = "2015" [dependencies] -your-face = { version = "0.0.0", path = "dependency", optional = true, default-features = false, features = ["nose", "mouth"], registry = "alternative" } +# Before my-package1 +your-face = { version = "0.0.0", path = "dependency", optional = true, default-features = false, features = ["nose", "mouth"], registry = "alternative" } # After my-package1 +# End diff --git a/tests/testsuite/cargo_add/overwrite_path_noop/out/Cargo.toml b/tests/testsuite/cargo_add/overwrite_path_noop/out/Cargo.toml index bef5158b9d6..db7e31b8b22 100644 --- a/tests/testsuite/cargo_add/overwrite_path_noop/out/Cargo.toml +++ b/tests/testsuite/cargo_add/overwrite_path_noop/out/Cargo.toml @@ -7,7 +7,9 @@ version = "0.0.0" edition = "2015" [dependencies] -your-face = { version = "0.0.0", path = "dependency", optional = true, default-features = false, features = ["nose", "mouth"], registry = "alternative" } +# Before my-package1 +your-face = { version = "0.0.0", path = "dependency", optional = true, default-features = false, features = ["nose", "mouth"], registry = "alternative" } # After my-package1 [features] your-face = ["dep:your-face"] +# End diff --git a/tests/testsuite/cargo_add/overwrite_preserves_inline_table/in/Cargo.toml b/tests/testsuite/cargo_add/overwrite_preserves_inline_table/in/Cargo.toml index 55f9a6114c1..6a13978aba5 100644 --- a/tests/testsuite/cargo_add/overwrite_preserves_inline_table/in/Cargo.toml +++ b/tests/testsuite/cargo_add/overwrite_preserves_inline_table/in/Cargo.toml @@ -6,4 +6,6 @@ version = "0.0.0" edition = "2015" [dependencies] -your-face={version="99999.0.0",features=["eyes"]} # Hello world +# Before my-package1 +your-face={version="99999.0.0",features=["eyes"]} # After my-package1 +# End diff --git a/tests/testsuite/cargo_add/overwrite_preserves_inline_table/out/Cargo.toml b/tests/testsuite/cargo_add/overwrite_preserves_inline_table/out/Cargo.toml index 3e45076bd8f..c89932828a1 100644 --- a/tests/testsuite/cargo_add/overwrite_preserves_inline_table/out/Cargo.toml +++ b/tests/testsuite/cargo_add/overwrite_preserves_inline_table/out/Cargo.toml @@ -6,4 +6,6 @@ version = "0.0.0" edition = "2015" [dependencies] -your-face={ version = "99999.0.0", features = ["eyes", "nose"] } # Hello world +# Before my-package1 +your-face={ version = "99999.0.0", features = ["eyes", "nose"] } # After my-package1 +# End diff --git a/tests/testsuite/cargo_add/overwrite_public/in/Cargo.toml b/tests/testsuite/cargo_add/overwrite_public/in/Cargo.toml index 62d53a42aff..746b18e682a 100644 --- a/tests/testsuite/cargo_add/overwrite_public/in/Cargo.toml +++ b/tests/testsuite/cargo_add/overwrite_public/in/Cargo.toml @@ -7,4 +7,6 @@ version = "0.0.0" edition = "2015" [dependencies] -my-package = "0.1.0" +# Before my-package +my-package = "0.1.0" # After my-package +# End diff --git a/tests/testsuite/cargo_add/overwrite_public/out/Cargo.toml b/tests/testsuite/cargo_add/overwrite_public/out/Cargo.toml index 2cd8b8ddefb..97e1b42ca85 100644 --- a/tests/testsuite/cargo_add/overwrite_public/out/Cargo.toml +++ b/tests/testsuite/cargo_add/overwrite_public/out/Cargo.toml @@ -7,4 +7,6 @@ version = "0.0.0" edition = "2015" [dependencies] -my-package = { version = "0.1.0", public = true } +# Before my-package +my-package = { version = "0.1.0", public = true } # After my-package +# End diff --git a/tests/testsuite/cargo_add/overwrite_public_with_no_public/in/Cargo.toml b/tests/testsuite/cargo_add/overwrite_public_with_no_public/in/Cargo.toml index 2cd8b8ddefb..97e1b42ca85 100644 --- a/tests/testsuite/cargo_add/overwrite_public_with_no_public/in/Cargo.toml +++ b/tests/testsuite/cargo_add/overwrite_public_with_no_public/in/Cargo.toml @@ -7,4 +7,6 @@ version = "0.0.0" edition = "2015" [dependencies] -my-package = { version = "0.1.0", public = true } +# Before my-package +my-package = { version = "0.1.0", public = true } # After my-package +# End diff --git a/tests/testsuite/cargo_add/overwrite_public_with_no_public/out/Cargo.toml b/tests/testsuite/cargo_add/overwrite_public_with_no_public/out/Cargo.toml index e774dd73b96..cdc60a3236a 100644 --- a/tests/testsuite/cargo_add/overwrite_public_with_no_public/out/Cargo.toml +++ b/tests/testsuite/cargo_add/overwrite_public_with_no_public/out/Cargo.toml @@ -7,4 +7,6 @@ version = "0.0.0" edition = "2015" [dependencies] -my-package = { version = "0.1.0" } +# Before my-package +my-package = { version = "0.1.0" } # After my-package +# End diff --git a/tests/testsuite/cargo_add/overwrite_rename_with_no_rename/in/Cargo.toml b/tests/testsuite/cargo_add/overwrite_rename_with_no_rename/in/Cargo.toml index 3eda58504fc..f23816ae4c0 100644 --- a/tests/testsuite/cargo_add/overwrite_rename_with_no_rename/in/Cargo.toml +++ b/tests/testsuite/cargo_add/overwrite_rename_with_no_rename/in/Cargo.toml @@ -6,4 +6,6 @@ version = "0.0.0" edition = "2015" [dependencies] -a1 = { package = "versioned-package", version = "0.1.1", optional = true } +# Before a1 +a1 = { package = "versioned-package", version = "0.1.1", optional = true } # After a1 +# End diff --git a/tests/testsuite/cargo_add/overwrite_rename_with_no_rename/out/Cargo.toml b/tests/testsuite/cargo_add/overwrite_rename_with_no_rename/out/Cargo.toml index ec42011788c..8233f083e87 100644 --- a/tests/testsuite/cargo_add/overwrite_rename_with_no_rename/out/Cargo.toml +++ b/tests/testsuite/cargo_add/overwrite_rename_with_no_rename/out/Cargo.toml @@ -6,5 +6,7 @@ version = "0.0.0" edition = "2015" [dependencies] -a1 = { package = "versioned-package", version = "0.1.1", optional = true } +# Before a1 +a1 = { package = "versioned-package", version = "0.1.1", optional = true } # After a1 versioned-package = "99999.0.0" +# End diff --git a/tests/testsuite/cargo_add/overwrite_rename_with_rename/in/Cargo.toml b/tests/testsuite/cargo_add/overwrite_rename_with_rename/in/Cargo.toml index 3eda58504fc..f23816ae4c0 100644 --- a/tests/testsuite/cargo_add/overwrite_rename_with_rename/in/Cargo.toml +++ b/tests/testsuite/cargo_add/overwrite_rename_with_rename/in/Cargo.toml @@ -6,4 +6,6 @@ version = "0.0.0" edition = "2015" [dependencies] -a1 = { package = "versioned-package", version = "0.1.1", optional = true } +# Before a1 +a1 = { package = "versioned-package", version = "0.1.1", optional = true } # After a1 +# End diff --git a/tests/testsuite/cargo_add/overwrite_rename_with_rename/out/Cargo.toml b/tests/testsuite/cargo_add/overwrite_rename_with_rename/out/Cargo.toml index 0964c43a147..32140b9c2d3 100644 --- a/tests/testsuite/cargo_add/overwrite_rename_with_rename/out/Cargo.toml +++ b/tests/testsuite/cargo_add/overwrite_rename_with_rename/out/Cargo.toml @@ -6,5 +6,7 @@ version = "0.0.0" edition = "2015" [dependencies] -a1 = { package = "versioned-package", version = "0.1.1", optional = true } +# Before a1 +a1 = { package = "versioned-package", version = "0.1.1", optional = true } # After a1 a2 = { version = "99999.0.0", package = "versioned-package" } +# End diff --git a/tests/testsuite/cargo_add/overwrite_rename_with_rename_noop/in/Cargo.toml b/tests/testsuite/cargo_add/overwrite_rename_with_rename_noop/in/Cargo.toml index 3eda58504fc..f23816ae4c0 100644 --- a/tests/testsuite/cargo_add/overwrite_rename_with_rename_noop/in/Cargo.toml +++ b/tests/testsuite/cargo_add/overwrite_rename_with_rename_noop/in/Cargo.toml @@ -6,4 +6,6 @@ version = "0.0.0" edition = "2015" [dependencies] -a1 = { package = "versioned-package", version = "0.1.1", optional = true } +# Before a1 +a1 = { package = "versioned-package", version = "0.1.1", optional = true } # After a1 +# End diff --git a/tests/testsuite/cargo_add/overwrite_rename_with_rename_noop/out/Cargo.toml b/tests/testsuite/cargo_add/overwrite_rename_with_rename_noop/out/Cargo.toml index a85cdf76cd2..69511c5d362 100644 --- a/tests/testsuite/cargo_add/overwrite_rename_with_rename_noop/out/Cargo.toml +++ b/tests/testsuite/cargo_add/overwrite_rename_with_rename_noop/out/Cargo.toml @@ -6,7 +6,9 @@ version = "0.0.0" edition = "2015" [dependencies] -a1 = { package = "versioned-package", version = "0.1.1", optional = true } +# Before a1 +a1 = { package = "versioned-package", version = "0.1.1", optional = true } # After a1 [features] a1 = ["dep:a1"] +# End diff --git a/tests/testsuite/cargo_add/overwrite_version_with_git/in/Cargo.toml b/tests/testsuite/cargo_add/overwrite_version_with_git/in/Cargo.toml index 2dd21265d5e..c952a611841 100644 --- a/tests/testsuite/cargo_add/overwrite_version_with_git/in/Cargo.toml +++ b/tests/testsuite/cargo_add/overwrite_version_with_git/in/Cargo.toml @@ -6,4 +6,6 @@ version = "0.0.0" edition = "2015" [dependencies] -versioned-package = { version = "0.1.1", optional = true } +# Before versioned-package +versioned-package = { version = "0.1.1", optional = true } # After versioned-package +# End diff --git a/tests/testsuite/cargo_add/overwrite_version_with_git/out/Cargo.toml b/tests/testsuite/cargo_add/overwrite_version_with_git/out/Cargo.toml index d90672218df..d8b4f8d1fb6 100644 --- a/tests/testsuite/cargo_add/overwrite_version_with_git/out/Cargo.toml +++ b/tests/testsuite/cargo_add/overwrite_version_with_git/out/Cargo.toml @@ -6,7 +6,9 @@ version = "0.0.0" edition = "2015" [dependencies] -versioned-package = { version = "0.3.0", optional = true, git = "[ROOTURL]/versioned-package" } +# Before versioned-package +versioned-package = { version = "0.3.0", optional = true, git = "[ROOTURL]/versioned-package" } # After versioned-package [features] versioned-package = ["dep:versioned-package"] +# End diff --git a/tests/testsuite/cargo_add/overwrite_with_rename/in/Cargo.toml b/tests/testsuite/cargo_add/overwrite_with_rename/in/Cargo.toml index 2dd21265d5e..c952a611841 100644 --- a/tests/testsuite/cargo_add/overwrite_with_rename/in/Cargo.toml +++ b/tests/testsuite/cargo_add/overwrite_with_rename/in/Cargo.toml @@ -6,4 +6,6 @@ version = "0.0.0" edition = "2015" [dependencies] -versioned-package = { version = "0.1.1", optional = true } +# Before versioned-package +versioned-package = { version = "0.1.1", optional = true } # After versioned-package +# End diff --git a/tests/testsuite/cargo_add/overwrite_with_rename/out/Cargo.toml b/tests/testsuite/cargo_add/overwrite_with_rename/out/Cargo.toml index 5f5389bdf46..0e787ede5a3 100644 --- a/tests/testsuite/cargo_add/overwrite_with_rename/out/Cargo.toml +++ b/tests/testsuite/cargo_add/overwrite_with_rename/out/Cargo.toml @@ -7,4 +7,6 @@ edition = "2015" [dependencies] renamed = { version = "99999.0.0", package = "versioned-package" } -versioned-package = { version = "0.1.1", optional = true } +# Before versioned-package +versioned-package = { version = "0.1.1", optional = true } # After versioned-package +# End