cleanCargoToml: do not strip edition fields

* The edition entries can affect cargo behavior, not just rustc
  behavior, so we should keep them in for consistency with what the
  project expects
This commit is contained in:
Ivan Petkov 2021-12-30 09:44:50 -08:00
parent cf1c6eb0e8
commit 234257c239
No known key found for this signature in database
GPG Key ID: BB6F9EFC065832B6
3 changed files with 20 additions and 11 deletions

View File

@ -42,7 +42,7 @@ doc = true
plugin = false
proc-macro = false
harness = true
edition = "2015"
edition = "2021"
crate-type = ["lib"]
required-features = ["libfeature1", "libfeature2"]
@ -69,7 +69,7 @@ doc = true
plugin = false
proc-macro = false
harness = true
edition = "2015"
edition = "2018"
required-features = ["bin2feature1", "bin2feature2"]
[[example]]
@ -95,7 +95,7 @@ doc = true
plugin = false
proc-macro = false
harness = true
edition = "2015"
edition = "2018"
required-features = ["example2feature1", "example2feature2"]
[[test]]
@ -121,7 +121,7 @@ doc = true
plugin = false
proc-macro = false
harness = true
edition = "2015"
edition = "2018"
required-features = ["test2feature1", "test2feature2"]
[[bench]]
@ -147,7 +147,7 @@ doc = true
plugin = false
proc-macro = false
harness = true
edition = "2015"
edition = "2018"
required-features = ["bench2feature1", "bench2feature2"]
[dependencies]

View File

@ -26,11 +26,13 @@ barfeature = ["foofeature"]
foofeature = []
[lib]
edition = "2021"
name = "foo"
path = "/nix/store/dummy.rs"
required-features = ["libfeature1", "libfeature2"]
[package]
edition = "2021"
name = "some name"
version = "1.2.3"
workspace = "some/path/to/workspace"
@ -77,41 +79,49 @@ exclude = ["crates/foo", "path/to/other"]
members = ["member1", "path/to/member2", "crates/*"]
[[bench]]
edition = "2015"
name = "bench1"
path = "/nix/store/dummy.rs"
required-features = ["bench1feature1", "bench1feature2"]
[[bench]]
edition = "2018"
name = "bench2"
path = "/nix/store/dummy.rs"
required-features = ["bench2feature1", "bench2feature2"]
[[bin]]
edition = "2015"
name = "bin1"
path = "/nix/store/dummy.rs"
required-features = ["bin1feature1", "bin1feature2"]
[[bin]]
edition = "2018"
name = "bin2"
path = "/nix/store/dummy.rs"
required-features = ["bin2feature1", "bin2feature2"]
[[example]]
edition = "2015"
name = "example1"
path = "/nix/store/dummy.rs"
required-features = ["example1feature1", "example1feature2"]
[[example]]
edition = "2018"
name = "example2"
path = "/nix/store/dummy.rs"
required-features = ["example2feature1", "example2feature2"]
[[test]]
edition = "2015"
name = "test1"
path = "/nix/store/dummy.rs"
required-features = ["test1feature1", "test1feature2"]
[[test]]
edition = "2018"
name = "test2"
path = "/nix/store/dummy.rs"
required-features = ["test2feature1", "test2feature2"]

View File

@ -1,5 +1,4 @@
{ fromTOML
, toTOML
, writeText
}:
@ -23,7 +22,6 @@ let
"default-run"
"description"
"documentation"
"edition"
"exclude"
"homepage"
"include"
@ -40,9 +38,10 @@ let
# Additional package attributes which are expressly kept in
# (but listed here for audit purposes)
# "name" # The name of the package.
# "version" # The version of the package.
# "workspace" # Path to the workspace for the package.
# "edition" # Influences cargo behavior
# "name" # Required
# "version" # Required
# "workspace" # Keep project structure as is
];
# https://doc.rust-lang.org/cargo/reference/cargo-targets.html#configuring-a-target
@ -54,7 +53,6 @@ let
"doctest"
"bench"
"doc"
"edition"
"plugin"
"proc-macro"
"harness"
@ -62,6 +60,7 @@ let
# Additional package attributes which are expressly kept in
# (but listed here for audit purposes)
# "edition" # Influences cargo behavior
# "name" # let cargo manage targets/collisions/etc.
# "required-features" # influences dependency feature combinations
];