From d37c4836fc31765ecf05c952e4db4b6592119ed1 Mon Sep 17 00:00:00 2001 From: schvv31n Date: Mon, 17 Feb 2025 23:03:58 +0000 Subject: [PATCH] Add a `#[allow(dead_code)]` to the function if the test isn't executed --- crates/test-macro/src/lib.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/crates/test-macro/src/lib.rs b/crates/test-macro/src/lib.rs index c9e27eb6f63..6ff84219eda 100644 --- a/crates/test-macro/src/lib.rs +++ b/crates/test-macro/src/lib.rs @@ -136,6 +136,10 @@ pub fn wasm_bindgen_test( quote! { #[cfg_attr(not(all(target_arch = "wasm32", any(target_os = "unknown", target_os = "none"))), #ignore)] } ) } + } else { + tokens.extend(quote! { + #[cfg_attr(not(all(target_arch = "wasm32", any(target_os = "unknown", target_os = "none"))), allow(dead_code))] + }); } tokens.extend(leading_tokens);