From 961de1ffd61143cddff72a203fcc8a7f18e7fdea Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Mon, 6 May 2024 18:36:38 -0700 Subject: [PATCH] Resolve unexpected_cfgs warning --- build.rs | 5 +++++ src/lib.rs | 1 + 2 files changed, 6 insertions(+) diff --git a/build.rs b/build.rs index 1d619e19af..00868853dd 100644 --- a/build.rs +++ b/build.rs @@ -14,6 +14,11 @@ fn main() { // Note: add "/build.rs" to package.include in Cargo.toml if adding any // conditional compilation within the library. + println!("cargo:rustc-cfg=check_cfg"); + println!("cargo:rustc-check-cfg=cfg(check_cfg)"); + println!("cargo:rustc-check-cfg=cfg(doc_cfg)"); + println!("cargo:rustc-check-cfg=cfg(syn_disable_nightly_tests)"); + if !unstable() { println!("cargo:rustc-cfg=syn_disable_nightly_tests"); } diff --git a/src/lib.rs b/src/lib.rs index 898d2e684e..b2e3e8e841 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -253,6 +253,7 @@ #![cfg_attr(doc_cfg, feature(doc_cfg))] #![deny(unsafe_op_in_unsafe_fn)] #![allow(non_camel_case_types)] +#![cfg_attr(not(check_cfg), allow(unexpected_cfgs))] #![allow( clippy::bool_to_int_with_if, clippy::cast_lossless,