Skip to content

Commit

Permalink
Suppress unexpected cfgs lint when built without build script
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed May 7, 2024
1 parent 462896c commit 1d9011d
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions gen/build/src/lib.rs
Expand Up @@ -46,6 +46,7 @@
//! ```

#![doc(html_root_url = "https://docs.rs/cxx-build/1.0.122")]
#![cfg_attr(not(check_cfg), allow(unexpected_cfgs))]
#![allow(
clippy::cast_sign_loss,
clippy::default_trait_access,
Expand Down
1 change: 1 addition & 0 deletions gen/cmd/src/main.rs
@@ -1,3 +1,4 @@
#![cfg_attr(not(check_cfg), allow(unexpected_cfgs))]
#![allow(
clippy::cast_sign_loss,
clippy::cognitive_complexity,
Expand Down
1 change: 1 addition & 0 deletions gen/lib/src/lib.rs
Expand Up @@ -10,6 +10,7 @@
#![doc(html_root_url = "https://docs.rs/cxx-gen/0.7.122")]
#![deny(missing_docs)]
#![allow(dead_code)]
#![cfg_attr(not(check_cfg), allow(unexpected_cfgs))]
#![allow(
clippy::cast_sign_loss,
clippy::default_trait_access,
Expand Down
2 changes: 2 additions & 0 deletions tools/cargo/build.rs
Expand Up @@ -48,6 +48,8 @@ through crates.io.
";

fn main() {
println!("cargo:rustc-cfg=check_cfg");
println!("cargo:rustc-check-cfg=cfg(check_cfg)");
println!("cargo:rustc-check-cfg=cfg(feature, values(\"experimental-async-fn\"))");
println!("cargo:rustc-check-cfg=cfg(feature, values(\"experimental-enum-variants-from-header\"))");

Expand Down

0 comments on commit 1d9011d

Please sign in to comment.