From e27311776cd74c42dc6aa4a4f058a125627e1265 Mon Sep 17 00:00:00 2001 From: Kero Date: Sat, 23 Nov 2024 00:07:18 +0800 Subject: [PATCH] chore: replace if-cfg with #[cfg(..)] (#416) --- core/src/provider/rpc.rs | 14 ++++++-------- provers/sgx/prover/src/lib.rs | 10 ++++------ 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/core/src/provider/rpc.rs b/core/src/provider/rpc.rs index 9f21ea9cc..495262430 100644 --- a/core/src/provider/rpc.rs +++ b/core/src/provider/rpc.rs @@ -7,7 +7,6 @@ use raiko_lib::clear_line; use reqwest_alloy::Client; use reth_primitives::revm_primitives::{AccountInfo, Bytecode}; use std::collections::HashMap; -use tracing::trace; use crate::{ interfaces::{RaikoError, RaikoResult}, @@ -230,13 +229,12 @@ impl BlockDataProvider for RpcBlockDataProvider { let batch_limit = 1000; while !accounts.is_empty() { - if cfg!(debug_assertions) { - raiko_lib::inplace_print(&format!( - "fetching storage proof {idx}/{num_storage_proofs}..." - )); - } else { - trace!("Fetching storage proof {idx}/{num_storage_proofs}..."); - } + #[cfg(debug_assertions)] + raiko_lib::inplace_print(&format!( + "fetching storage proof {idx}/{num_storage_proofs}..." + )); + #[cfg(not(debug_assertions))] + tracing::trace!("Fetching storage proof {idx}/{num_storage_proofs}..."); // Create a batch for all storage proofs let mut batch = self.client.new_batch(); diff --git a/provers/sgx/prover/src/lib.rs b/provers/sgx/prover/src/lib.rs index 334f063f3..7886ac640 100644 --- a/provers/sgx/prover/src/lib.rs +++ b/provers/sgx/prover/src/lib.rs @@ -62,12 +62,10 @@ impl From for Proof { } pub const ELF_NAME: &str = "sgx-guest"; -pub const CONFIG: &str = if cfg!(feature = "docker_build") { - "../provers/sgx/config" -} else { - "../../provers/sgx/config" -}; - +#[cfg(feature = "docker_build")] +pub const CONFIG: &str = "../provers/sgx/config"; +#[cfg(not(feature = "docker_build"))] +pub const CONFIG: &str = "../../provers/sgx/config"; static GRAMINE_MANIFEST_TEMPLATE: Lazy> = Lazy::new(OnceCell::new); static PRIVATE_KEY: Lazy> = Lazy::new(OnceCell::new);