From 496973f300542b91ed5d6114303068a96017e170 Mon Sep 17 00:00:00 2001 From: Veetaha Date: Sun, 22 Dec 2024 23:54:17 +0000 Subject: [PATCH 1/5] Add CI check --- .github/workflows/ci.yml | 4 ++++ Cargo.toml | 2 ++ bon/tests/integration/main.rs | 4 +++- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 575ca7b4..813d65e5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -166,6 +166,10 @@ jobs: --allow edition-2024-expr-fragment-specifier \ --allow if_let_rescope \ --allow impl-trait-overcaptures + env: + RUSTFLAGS: >- + --deny warnings + --cfg nightly cargo-miri: runs-on: ubuntu-latest diff --git a/Cargo.toml b/Cargo.toml index ed864851..4be6a7c6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -148,6 +148,8 @@ missing_crate_level_docs = "warn" unescaped_backticks = "warn" [workspace.lints.rust] +unexpected_cfgs = { level = "warn", check-cfg = ['cfg(nightly)'] } + # This lint is used only to warn about the changes in drop order during the # transition from Rust 2021 to Rust 2024. There are too many instances of this # lint in our code base and some of them may be false positives. So we just allow diff --git a/bon/tests/integration/main.rs b/bon/tests/integration/main.rs index 276f0a06..3f5e5e19 100644 --- a/bon/tests/integration/main.rs +++ b/bon/tests/integration/main.rs @@ -10,7 +10,9 @@ missing_docs, impl_trait_overcaptures, )] - +// This catches the problem of `clippy::empty_enum` lint triggering. +// This lint is enabled only when `feature(never_type)` is enabled. +#[cfg_attr(nightly, feature(never_type))] #[cfg(feature = "alloc")] extern crate alloc; From 0a71bff96ad358ff3860878f30f464741a6a6c18 Mon Sep 17 00:00:00 2001 From: Veetaha Date: Sun, 22 Dec 2024 23:56:16 +0000 Subject: [PATCH 2/5] Fix --- bon/tests/integration/main.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bon/tests/integration/main.rs b/bon/tests/integration/main.rs index 3f5e5e19..7716ebf7 100644 --- a/bon/tests/integration/main.rs +++ b/bon/tests/integration/main.rs @@ -12,7 +12,8 @@ )] // This catches the problem of `clippy::empty_enum` lint triggering. // This lint is enabled only when `feature(never_type)` is enabled. -#[cfg_attr(nightly, feature(never_type))] +#![cfg_attr(nightly, feature(never_type))] + #[cfg(feature = "alloc")] extern crate alloc; From 3d6143816b085b54b180e0fe0c82ff22aeb35b22 Mon Sep 17 00:00:00 2001 From: Veetaha Date: Sun, 22 Dec 2024 23:55:54 +0000 Subject: [PATCH 3/5] Use empty struct instead of an empty enum --- bon-macros/src/builder/builder_gen/state_mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bon-macros/src/builder/builder_gen/state_mod.rs b/bon-macros/src/builder/builder_gen/state_mod.rs index 9185d740..7f22ac65 100644 --- a/bon-macros/src/builder/builder_gen/state_mod.rs +++ b/bon-macros/src/builder/builder_gen/state_mod.rs @@ -271,7 +271,7 @@ impl<'a> StateModGenCtx<'a> { #[allow(non_camel_case_types)] mod members { #( - #vis_child_child enum #stateful_members_snake {} + #vis_child_child struct #stateful_members_snake(()); )* } } From fc37f51f8b597f7b1781d66f1b281fc707bc716c Mon Sep 17 00:00:00 2001 From: Veetaha Date: Sun, 22 Dec 2024 23:59:42 +0000 Subject: [PATCH 4/5] allow unstable features --- bon/tests/integration/main.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bon/tests/integration/main.rs b/bon/tests/integration/main.rs index 7716ebf7..3d8cbf13 100644 --- a/bon/tests/integration/main.rs +++ b/bon/tests/integration/main.rs @@ -12,7 +12,7 @@ )] // This catches the problem of `clippy::empty_enum` lint triggering. // This lint is enabled only when `feature(never_type)` is enabled. -#![cfg_attr(nightly, feature(never_type))] +#![cfg_attr(nightly, allow(unstable_features), feature(never_type))] #[cfg(feature = "alloc")] extern crate alloc; From ee0fcc5891c269a25db9f92eb0be3a55e67d2b4a Mon Sep 17 00:00:00 2001 From: Veetaha Date: Mon, 23 Dec 2024 00:01:18 +0000 Subject: [PATCH 5/5] Fix --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 813d65e5..f4c5d5b4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -169,7 +169,7 @@ jobs: env: RUSTFLAGS: >- --deny warnings - --cfg nightly + --cfg ${{ matrix.toolchain }} cargo-miri: runs-on: ubuntu-latest