Skip to content

Commit 620ca56

Browse files
author
the Mulhern
committed
Emit expected cfg instructions in build.rs
It is no longer necessary to use the temporary workaround in Cargo.toml of specifying the expected values in unexpected_cfgs table. Remove the unexpected_cfgs deny from Cargo.toml entirely. unexpected_cfgs is warn by default, and Cargo.toml already specifies that all warnings should be denied. Signed-off-by: the Mulhern <amulhern@amulhern.bos.csb>
1 parent fdbb669 commit 620ca56

2 files changed

Lines changed: 10 additions & 10 deletions

File tree

Cargo.toml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,6 @@ future_incompatible = { level = "deny", priority = 1 }
5151
unused = { level = "deny", priority = 2}
5252
rust_2018_idioms = { level = "deny", priority = 3 }
5353
nonstandard_style = { level = "deny", priority = 4 }
54-
unexpected_cfgs = { level = "deny", check-cfg = [
55-
'cfg(cryptsetup23supported)', 'cfg(cryptsetup24supported)', 'cfg(cryptsetup27supported)'
56-
] }
5754

5855
[lints.clippy]
5956
all = { level = "deny" }

build.rs

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,16 @@ fn main() {
1818
Ok(l) => Version::parse(&l.version).unwrap(),
1919
Err(e) => panic!("Bindings require at least cryptsetup-2.2.0: {e}"),
2020
};
21-
for ver in SUPPORTED_VERSIONS.iter().take_while(|ver_string| {
22-
let iter_version = Version::parse(ver_string).expect("Could not parse version");
23-
version >= iter_version
24-
}) {
25-
println!(
26-
"cargo:rustc-cfg=cryptsetup{}supported",
27-
ver.split('.').take(2).collect::<Vec<_>>().join("")
21+
for ver_string in SUPPORTED_VERSIONS.iter() {
22+
let version_cfg = format!(
23+
"cryptsetup{}supported",
24+
ver_string.split('.').take(2).collect::<Vec<_>>().join("")
2825
);
26+
println!("cargo::rustc-check-cfg=cfg({version_cfg},)");
27+
28+
let iter_version = Version::parse(ver_string).expect("Could not parse version");
29+
if version >= iter_version {
30+
println!("cargo:rustc-cfg={version_cfg}");
31+
}
2932
}
3033
}

0 commit comments

Comments
 (0)