From 78b709b1207f4fecc9b6cc9bae34386d9b4a19db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Marcos?= <164224824+marcospb19-cw@users.noreply.github.com> Date: Fri, 2 Aug 2024 14:54:43 -0300 Subject: [PATCH] chore: solve warnings (#1593) --- src/eth/executor/executor.rs | 1 + src/eth/rpc/rpc_context.rs | 1 - src/eth/rpc/rpc_middleware.rs | 3 +++ src/eth/storage/rocks/rocks_state.rs | 1 + 4 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/eth/executor/executor.rs b/src/eth/executor/executor.rs index 8ba514f92..2a85240a2 100644 --- a/src/eth/executor/executor.rs +++ b/src/eth/executor/executor.rs @@ -7,6 +7,7 @@ use anyhow::anyhow; use tracing::info_span; use tracing::Span; +#[cfg(feature = "metrics")] use crate::eth::codegen; use crate::eth::executor::Evm; use crate::eth::executor::EvmExecutionResult; diff --git a/src/eth/rpc/rpc_context.rs b/src/eth/rpc/rpc_context.rs index 90bfec7bf..a7aafe192 100644 --- a/src/eth/rpc/rpc_context.rs +++ b/src/eth/rpc/rpc_context.rs @@ -23,7 +23,6 @@ pub struct RpcContext { // services pub executor: Arc, - #[allow(dead_code)] // HACK this was triggered in Rust 1.79 pub miner: Arc, pub storage: Arc, pub consensus: Arc, diff --git a/src/eth/rpc/rpc_middleware.rs b/src/eth/rpc/rpc_middleware.rs index 34af7e9e9..5bb90d112 100644 --- a/src/eth/rpc/rpc_middleware.rs +++ b/src/eth/rpc/rpc_middleware.rs @@ -34,6 +34,7 @@ use crate::eth::rpc::RpcClientApp; use crate::event_with; use crate::ext::from_json_str; use crate::ext::to_json_value; +#[cfg(feature = "metrics")] use crate::if_else; use crate::infra::metrics; use crate::infra::tracing::new_cid; @@ -164,6 +165,8 @@ impl<'a> Future for RpcResponse<'a> { // trace response let response_success = response.is_success(); let response_result: JsonValue = from_json_str(response.as_result()); + + #[cfg_attr(not(feature = "metrics"), allow(unused_variables))] let (level, error_code) = match response_result .get("error") .and_then(|v| v.get("code")) diff --git a/src/eth/storage/rocks/rocks_state.rs b/src/eth/storage/rocks/rocks_state.rs index f506c0d0b..f01f53de6 100644 --- a/src/eth/storage/rocks/rocks_state.rs +++ b/src/eth/storage/rocks/rocks_state.rs @@ -151,6 +151,7 @@ impl RocksStorageState { /// Get the filename of the database path. /// /// Should be checked on creation. + #[cfg(feature = "metrics")] fn db_path_filename(&self) -> &str { self.db.path().file_name().unwrap().to_str().unwrap() }