From 778dd29448989cc3da8d967252d3589cddd58a54 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Mon, 6 May 2024 11:36:13 -0700 Subject: [PATCH] Resolve unexpected_cfgs warning warning: unexpected `cfg` condition name: `async_trait_nightly_testing` --> tests/test.rs:2:5 | 2 | async_trait_nightly_testing, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: expected names are: `clippy`, `debug_assertions`, `doc`, `docsrs`, `doctest`, `feature`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `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(async_trait_nightly_testing)");` to the top of the `build.rs` = note: see for more information about checking conditional configuration = note: `#[warn(unexpected_cfgs)]` on by default warning: unexpected `cfg` condition name: `async_trait_nightly_testing` --> tests/test.rs:380:7 | 380 | #[cfg(async_trait_nightly_testing)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: consider using a Cargo feature instead or adding `println!("cargo::rustc-check-cfg=cfg(async_trait_nightly_testing)");` to the top of the `build.rs` = note: see for more information about checking conditional configuration warning: unexpected `cfg` condition name: `async_trait_nightly_testing` --> tests/test.rs:1298:7 | 1298 | #[cfg(async_trait_nightly_testing)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: consider using a Cargo feature instead or adding `println!("cargo::rustc-check-cfg=cfg(async_trait_nightly_testing)");` to the top of the `build.rs` = note: see for more information about checking conditional configuration warning: unexpected `cfg` condition name: `async_trait_nightly_testing` --> tests/test.rs:1627:7 | 1627 | #[cfg(async_trait_nightly_testing)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: consider using a Cargo feature instead or adding `println!("cargo::rustc-check-cfg=cfg(async_trait_nightly_testing)");` to the top of the `build.rs` = note: see for more information about checking conditional configuration --- Cargo.toml | 1 + build.rs | 5 +++++ 2 files changed, 6 insertions(+) create mode 100644 build.rs diff --git a/Cargo.toml b/Cargo.toml index 6a34bdc..1e5b52e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,6 +6,7 @@ categories = ["asynchronous", "no-std"] description = "Type erasure for async trait methods" documentation = "https://docs.rs/async-trait" edition = "2021" +exclude = ["build.rs"] keywords = ["async"] license = "MIT OR Apache-2.0" repository = "https://github.com/dtolnay/async-trait" diff --git a/build.rs b/build.rs new file mode 100644 index 0000000..7072aac --- /dev/null +++ b/build.rs @@ -0,0 +1,5 @@ +fn main() { + // Warning: build.rs is not published to crates.io. + + println!("cargo:rustc-check-cfg=cfg(async_trait_nightly_testing)"); +}