Skip to content

Commit

Permalink
Resolve unexpected_cfgs warning
Browse files Browse the repository at this point in the history
    warning: unexpected `cfg` condition name: `exhaustive`
     --> tests/exhaustive.rs:1:8
      |
    1 | #![cfg(exhaustive)]
      |        ^^^^^^^^^^
      |
      = 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(exhaustive)");` to the top of the `build.rs`
      = note: see <https://doc.rust-lang.org/nightly/cargo/reference/build-scripts.html#rustc-check-cfg> for more information about checking conditional configuration
      = note: `#[warn(unexpected_cfgs)]` on by default
  • Loading branch information
dtolnay committed May 7, 2024
1 parent 7b7c262 commit 6132d8b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
7 changes: 7 additions & 0 deletions build.rs
Original file line number Diff line number Diff line change
@@ -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)");
}
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 6132d8b

Please sign in to comment.