diff --git a/Cargo.toml b/Cargo.toml index 9ebc0548..36ea5f80 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -51,9 +51,6 @@ future_incompatible = { level = "deny", priority = 1 } unused = { level = "deny", priority = 2} rust_2018_idioms = { level = "deny", priority = 3 } nonstandard_style = { level = "deny", priority = 4 } -unexpected_cfgs = { level = "deny", check-cfg = [ - 'cfg(cryptsetup23supported)', 'cfg(cryptsetup24supported)', 'cfg(cryptsetup27supported)' -] } [lints.clippy] all = { level = "deny" } diff --git a/build.rs b/build.rs index 65c654a2..a1e74a20 100644 --- a/build.rs +++ b/build.rs @@ -18,13 +18,16 @@ fn main() { Ok(l) => Version::parse(&l.version).unwrap(), Err(e) => panic!("Bindings require at least cryptsetup-2.2.0: {e}"), }; - for ver in SUPPORTED_VERSIONS.iter().take_while(|ver_string| { - let iter_version = Version::parse(ver_string).expect("Could not parse version"); - version >= iter_version - }) { - println!( - "cargo:rustc-cfg=cryptsetup{}supported", - ver.split('.').take(2).collect::>().join("") + for ver_string in SUPPORTED_VERSIONS.iter() { + let version_cfg = format!( + "cryptsetup{}supported", + ver_string.split('.').take(2).collect::>().join("") ); + println!("cargo::rustc-check-cfg=cfg({version_cfg})"); + + let iter_version = Version::parse(ver_string).expect("Could not parse version"); + if version >= iter_version { + println!("cargo:rustc-cfg={version_cfg}"); + } } }