From eb67e873e01c6dcb9716df34d8bf180e69ad88d7 Mon Sep 17 00:00:00 2001 From: "Tobin C. Harding" Date: Thu, 5 Sep 2024 12:44:13 +1000 Subject: [PATCH] Allow unused variables in release mode In release mode we have a few unused variable warnings, lets just allow them. Found when running bench code, interestingly `cargo bench` must build in release mode. --- bitcoin/src/consensus/serde.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/bitcoin/src/consensus/serde.rs b/bitcoin/src/consensus/serde.rs index 9d577047f..143851a62 100644 --- a/bitcoin/src/consensus/serde.rs +++ b/bitcoin/src/consensus/serde.rs @@ -159,6 +159,7 @@ struct DisplayWrapper<'a, T: 'a + Encodable, E>(&'a T, PhantomData); impl<'a, T: 'a + Encodable, E: ByteEncoder> fmt::Display for DisplayWrapper<'a, T, E> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { let mut writer = IoWrapper::<'_, _, E::Encoder>::new(f, E::default().into()); + #[allow(unused_variables)] // When debug_assertions are not enabled. self.0.consensus_encode(&mut writer).map_err(|error| { #[cfg(debug_assertions)] { @@ -199,6 +200,7 @@ impl ErrorTrackingWriter { } #[track_caller] + #[allow(unused_variables)] // When debug_assertions are not enabled. fn assert_no_error(&self, fun: &str) { #[cfg(debug_assertions)] { @@ -217,6 +219,7 @@ impl ErrorTrackingWriter { } } + #[allow(unused_variables)] // When debug_assertions are not enabled. fn set_error(&mut self, was: bool) { #[cfg(debug_assertions)] {