diff --git a/Cargo.toml b/Cargo.toml index aab4449..8ffa282 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,7 +6,7 @@ categories = ["value-formatting", "no-std", "no-std::no-alloc"] description = "Fast floating point to string conversion" documentation = "https://docs.rs/ryu" edition = "2018" -exclude = ["performance.png", "chart/**"] +exclude = ["build.rs", "performance.png", "chart/**"] keywords = ["float"] license = "Apache-2.0 OR BSL-1.0" repository = "https://github.com/dtolnay/ryu" diff --git a/build.rs b/build.rs new file mode 100644 index 0000000..ecd2acf --- /dev/null +++ b/build.rs @@ -0,0 +1,7 @@ +fn main() { + // Warning: build.rs is not published to crates.io. + + println!("cargo:rustc-cfg=check_cfg"); + println!("cargo:rustc-check-cfg=cfg(check_cfg)"); + println!("cargo:rustc-check-cfg=cfg(exhaustive)"); +} diff --git a/src/lib.rs b/src/lib.rs index 0ec6038..fb1d071 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -82,6 +82,7 @@ #![no_std] #![doc(html_root_url = "https://docs.rs/ryu/1.0.17")] +#![cfg_attr(not(check_cfg), allow(unexpected_cfgs))] #![allow( clippy::cast_lossless, clippy::cast_possible_truncation,