Skip to content

Commit 6b08996

Browse files
authored
Bump cargo-manifest to 0.18 (#289)
Allow packages using resolver v3 to be built by `cargo-chef`
1 parent a228626 commit 6b08996

File tree

4 files changed

+51
-61
lines changed

4 files changed

+51
-61
lines changed

Cargo.lock

Lines changed: 30 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ env_logger = "0.10"
2828
globwalk = "0.8.0"
2929
anyhow = "1.0.33"
3030
pathdiff = "0.2.0"
31-
cargo-manifest = "0.14"
31+
cargo-manifest = "0.18"
3232
fs-err = "2.5.0"
3333
toml = { version = "0.8", features = ["preserve_order"] }
3434
expect-test = "1.1.0"

src/skeleton/mod.rs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -158,14 +158,11 @@ fn panic(_: &core::panic::PanicInfo) -> ! {
158158
let parsed_manifest =
159159
cargo_manifest::Manifest::from_slice(manifest.contents.as_bytes())?;
160160

161-
let is_harness = |products: &Option<Vec<Product>>, name: &str| -> bool {
161+
let is_harness = |products: &[Product], name: &str| -> bool {
162162
products
163-
.as_ref()
164-
.and_then(|v| {
165-
v.iter()
166-
.find(|product| product.name.as_deref() == Some(name))
167-
.map(|p| p.harness)
168-
})
163+
.iter()
164+
.find(|product| product.name.as_deref() == Some(name))
165+
.map(|p| p.harness)
169166
.unwrap_or(true)
170167
};
171168

tests/skeletons.rs

Lines changed: 16 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -668,16 +668,14 @@ version = "1.8.1"
668668
check(
669669
&second.contents,
670670
expect_test::expect![[r#"
671-
bench = []
672-
test = []
673-
example = []
674-
675671
[[bin]]
676672
path = "src/main.rs"
677673
name = "test-dummy"
678674
plugin = false
679675
proc-macro = false
676+
edition = "2018"
680677
required-features = []
678+
crate-type = ["bin"]
681679
682680
[package]
683681
name = "project-a"
@@ -692,11 +690,6 @@ version = "1.8.1"
692690
check(
693691
&third.contents,
694692
expect_test::expect![[r#"
695-
bin = []
696-
bench = []
697-
test = []
698-
example = []
699-
700693
[package]
701694
name = "project_b"
702695
edition = "2018"
@@ -710,8 +703,11 @@ version = "1.8.1"
710703
path = "../project-a"
711704
712705
[lib]
706+
path = "src/lib.rs"
707+
name = "project_b"
713708
plugin = false
714709
proc-macro = false
710+
edition = "2018"
715711
required-features = []
716712
crate-type = ["cdylib"]
717713
"#]],
@@ -857,16 +853,14 @@ version = "1.8.1"
857853
check(
858854
&second.contents,
859855
expect_test::expect![[r#"
860-
bench = []
861-
test = []
862-
example = []
863-
864856
[[bin]]
865857
path = "src/main.rs"
866858
name = "test-dummy"
867859
plugin = false
868860
proc-macro = false
861+
edition = "2018"
869862
required-features = []
863+
crate-type = ["bin"]
870864
871865
[package]
872866
name = "project_a"
@@ -881,11 +875,6 @@ version = "1.8.1"
881875
check(
882876
&third.contents,
883877
expect_test::expect![[r#"
884-
bin = []
885-
bench = []
886-
test = []
887-
example = []
888-
889878
[package]
890879
name = "project_b"
891880
edition = "2018"
@@ -894,8 +883,11 @@ version = "1.8.1"
894883
[dependencies]
895884
896885
[lib]
886+
path = "src/lib.rs"
887+
name = "project_b"
897888
plugin = false
898889
proc-macro = false
890+
edition = "2018"
899891
required-features = []
900892
crate-type = ["cdylib"]
901893
"#]],
@@ -1019,17 +1011,14 @@ checksum = "3df10e9ed85b51fa3434bc5676eaa90479ce14ac3e101c8ce07e1bb5ef0b7255"
10191011
check(
10201012
&second.contents,
10211013
expect_test::expect![[r#"
1022-
bench = []
1023-
test = []
1024-
example = []
1025-
10261014
[[bin]]
10271015
path = "src/main.rs"
10281016
name = "binary"
10291017
plugin = false
10301018
proc-macro = false
10311019
edition = "2021"
10321020
required-features = []
1021+
crate-type = ["bin"]
10331022
10341023
[package]
10351024
name = "binary"
@@ -1049,11 +1038,6 @@ checksum = "3df10e9ed85b51fa3434bc5676eaa90479ce14ac3e101c8ce07e1bb5ef0b7255"
10491038
check(
10501039
&third.contents,
10511040
expect_test::expect![[r#"
1052-
bin = []
1053-
bench = []
1054-
test = []
1055-
example = []
1056-
10571041
[package]
10581042
name = "without"
10591043
edition = "2021"
@@ -1068,7 +1052,7 @@ checksum = "3df10e9ed85b51fa3434bc5676eaa90479ce14ac3e101c8ce07e1bb5ef0b7255"
10681052
proc-macro = false
10691053
edition = "2021"
10701054
required-features = []
1071-
crate-type = ["rlib"]
1055+
crate-type = ["lib"]
10721056
"#]],
10731057
);
10741058
}
@@ -1302,16 +1286,13 @@ anyhow = { workspace = true }
13021286
check(
13031287
&second.contents,
13041288
expect_test::expect![[r#"
1305-
bench = []
1306-
test = []
1307-
example = []
1308-
13091289
[[bin]]
13101290
path = "src/main.rs"
13111291
name = "project_a"
13121292
plugin = false
13131293
proc-macro = false
13141294
required-features = []
1295+
crate-type = ["bin"]
13151296
13161297
[package]
13171298
name = "project_a"
@@ -1334,11 +1315,6 @@ anyhow = { workspace = true }
13341315
check(
13351316
&third.contents,
13361317
expect_test::expect![[r#"
1337-
bin = []
1338-
bench = []
1339-
test = []
1340-
example = []
1341-
13421318
[package]
13431319
name = "project_b"
13441320
@@ -1358,6 +1334,8 @@ anyhow = { workspace = true }
13581334
workspace = true
13591335
13601336
[lib]
1337+
path = "src/lib.rs"
1338+
name = "project_b"
13611339
plugin = false
13621340
proc-macro = false
13631341
required-features = []
@@ -1450,11 +1428,6 @@ version = "0.2.1"
14501428
check(
14511429
&skeleton.manifests[1].contents,
14521430
expect![[r#"
1453-
bin = []
1454-
bench = []
1455-
test = []
1456-
example = []
1457-
14581431
[package]
14591432
name = "a"
14601433
version = "0.0.1"
@@ -1470,7 +1443,7 @@ version = "0.2.1"
14701443
plugin = false
14711444
proc-macro = false
14721445
required-features = []
1473-
crate-type = ["rlib"]
1446+
crate-type = ["lib"]
14741447
"#]],
14751448
);
14761449
}

0 commit comments

Comments
 (0)