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 673bbccc6..1e1376991 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() }