From 4db08b10a39cfd189a36a88dee0fad578ac11cbe Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Fri, 7 Jun 2024 19:36:27 -0700 Subject: [PATCH] Ignore warning on unused struct in test warning: struct `OptSourceNoBacktrace` is never constructed --> tests/test_option.rs:10:16 | 10 | pub struct OptSourceNoBacktrace { | ^^^^^^^^^^^^^^^^^^^^ | = note: `#[warn(dead_code)]` on by default warning: struct `OptSourceAlwaysBacktrace` is never constructed --> tests/test_option.rs:17:16 | 17 | pub struct OptSourceAlwaysBacktrace { | ^^^^^^^^^^^^^^^^^^^^^^^^ warning: struct `NoSourceOptBacktrace` is never constructed --> tests/test_option.rs:25:16 | 25 | pub struct NoSourceOptBacktrace { | ^^^^^^^^^^^^^^^^^^^^ warning: struct `AlwaysSourceOptBacktrace` is never constructed --> tests/test_option.rs:32:16 | 32 | pub struct AlwaysSourceOptBacktrace { | ^^^^^^^^^^^^^^^^^^^^^^^^ warning: struct `OptSourceOptBacktrace` is never constructed --> tests/test_option.rs:40:16 | 40 | pub struct OptSourceOptBacktrace { | ^^^^^^^^^^^^^^^^^^^^^ --- tests/test_option.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/test_option.rs b/tests/test_option.rs index 5464b08..480170f 100644 --- a/tests/test_option.rs +++ b/tests/test_option.rs @@ -7,6 +7,7 @@ pub mod structs { #[derive(Error, Debug)] #[error("...")] + #[allow(dead_code)] pub struct OptSourceNoBacktrace { #[source] source: Option, @@ -14,6 +15,7 @@ pub mod structs { #[derive(Error, Debug)] #[error("...")] + #[allow(dead_code)] pub struct OptSourceAlwaysBacktrace { #[source] source: Option, @@ -22,6 +24,7 @@ pub mod structs { #[derive(Error, Debug)] #[error("...")] + #[allow(dead_code)] pub struct NoSourceOptBacktrace { #[backtrace] backtrace: Option, @@ -29,6 +32,7 @@ pub mod structs { #[derive(Error, Debug)] #[error("...")] + #[allow(dead_code)] pub struct AlwaysSourceOptBacktrace { source: anyhow::Error, #[backtrace] @@ -37,6 +41,7 @@ pub mod structs { #[derive(Error, Debug)] #[error("...")] + #[allow(dead_code)] pub struct OptSourceOptBacktrace { #[source] source: Option,