refactor: simplify ProofTaskMetrics default implementation

- Updated the ProofTaskMetrics struct to derive Default, removing the manual implementation of the default method.
- This change enhances code clarity and reduces boilerplate, while maintaining the same functionality.
This commit is contained in:
Yong Kang
2025-10-10 12:42:50 +00:00
parent aa34bf2460
commit 7a4b585270

View File

@@ -5,7 +5,7 @@ use std::sync::{
};
/// Metrics for blinded node fetching by proof workers.
#[derive(Clone, Debug)]
#[derive(Clone, Debug, Default)]
pub struct ProofTaskMetrics {
/// The actual metrics for blinded nodes.
pub task_metrics: ProofTaskTrieMetrics,
@@ -19,18 +19,6 @@ pub struct ProofTaskMetrics {
pub storage_nodes: Arc<AtomicU64>,
}
impl Default for ProofTaskMetrics {
fn default() -> Self {
Self {
task_metrics: ProofTaskTrieMetrics::default(),
storage_proofs: Arc::new(AtomicU64::new(0)),
account_proofs: Arc::new(AtomicU64::new(0)),
account_nodes: Arc::new(AtomicU64::new(0)),
storage_nodes: Arc::new(AtomicU64::new(0)),
}
}
}
impl ProofTaskMetrics {
/// Record the blinded node counts into the histograms.
pub fn record(&self) {