Jonas Platte d91e6d7e63
Simplify docsrs feature usage
- Don't instruct docs.rs to set it, it does so by default now:
  https://github.com/rust-lang/docs.rs/pull/2390
- Because of that, check-cfg also recognizes it and does not need
  extra configuration either.
2024-05-30 10:35:07 +02:00

23 lines
745 B
Rust

use std::{env, process};
fn main() {
// Prevent unnecessary rerunning of this build script
println!("cargo:rerun-if-changed=build.rs");
let tls_features = [
("tls-native", env::var_os("CARGO_FEATURE_TLS_NATIVE").is_some()),
("tls-rustls-native-roots", env::var_os("CARGO_FEATURE_TLS_RUSTLS_NATIVE_ROOTS").is_some()),
("tls-rustls-webpki-roots", env::var_os("CARGO_FEATURE_TLS_RUSTLS_WEBPKI_ROOTS").is_some()),
];
if tls_features.iter().filter(|(_, a)| *a).count() > 1 {
eprintln!("error: Only one tls features can be enabled.");
for (f, a) in &tls_features {
eprintln!(" {f}: {}", if *a { "enabled" } else { "disabled" });
}
process::exit(1);
}
}