From 84f01fa8d731c51842848a4e4d27750cefd879e0 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Mon, 6 May 2024 20:52:49 -0700 Subject: [PATCH] Resolve unexpected_cfgs warning warning: unexpected `cfg` condition name: `cfg_macro_not_allowed` --> src/lib.rs:235:11 | 235 | #[cfg(not(cfg_macro_not_allowed))] | ^^^^^^^^^^^^^^^^^^^^^ | = help: expected names are: `clippy`, `debug_assertions`, `doc`, `docsrs`, `doctest`, `feature`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, `windows` = help: consider using a Cargo feature instead or adding `println!("cargo::rustc-check-cfg=cfg(cfg_macro_not_allowed)");` to the top of the `build.rs` = note: see for more information about checking conditional configuration = note: `#[warn(unexpected_cfgs)]` on by default --- build/build.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/build/build.rs b/build/build.rs index 589bc93..05f88dc 100644 --- a/build/build.rs +++ b/build/build.rs @@ -73,6 +73,10 @@ fn main() { println!("cargo:rustc-cfg=cfg_macro_not_allowed"); } + if version.minor >= 80 { + println!("cargo:rustc-check-cfg=cfg(cfg_macro_not_allowed)"); + } + let version = format!("{:#?}\n", version); let out_dir = env::var_os("OUT_DIR").expect("OUT_DIR not set"); let out_file = Path::new(&out_dir).join("version.expr");