From 289e63c36bf0ab2e903e52e6518af8892fdfa0c3 Mon Sep 17 00:00:00 2001 From: Peilun Li Date: Thu, 20 Jun 2024 17:33:32 +0800 Subject: [PATCH] Fix clippy. --- node/router/src/libp2p_event_handler.rs | 6 +++++- node/storage/src/log_store/flow_store.rs | 2 +- node/storage/src/log_store/log_manager.rs | 8 ++++---- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/node/router/src/libp2p_event_handler.rs b/node/router/src/libp2p_event_handler.rs index 002dd1e..e9ef442 100644 --- a/node/router/src/libp2p_event_handler.rs +++ b/node/router/src/libp2p_event_handler.rs @@ -997,7 +997,11 @@ mod tests { assert_eq!(peer_id, *ctx.network_globals.peer_id.read()); assert_eq!( addr, - *ctx.network_globals.listen_multiaddrs.read().get(0).unwrap() + *ctx.network_globals + .listen_multiaddrs + .read() + .first() + .unwrap() ); } Ok(_) => panic!("Unexpected sync message type received"), diff --git a/node/storage/src/log_store/flow_store.rs b/node/storage/src/log_store/flow_store.rs index a1c581a..64fbe20 100644 --- a/node/storage/src/log_store/flow_store.rs +++ b/node/storage/src/log_store/flow_store.rs @@ -208,7 +208,7 @@ impl FlowRead for FlowStore { } fn get_shard_config(&self) -> ShardConfig { - self.config.shard_config.read().clone() + *self.config.shard_config.read() } } diff --git a/node/storage/src/log_store/log_manager.rs b/node/storage/src/log_store/log_manager.rs index 6993c7a..ba87cc2 100644 --- a/node/storage/src/log_store/log_manager.rs +++ b/node/storage/src/log_store/log_manager.rs @@ -170,7 +170,7 @@ impl LogStoreChunkWrite for LogManager { // TODO: Use another struct to avoid confusion. let mut flow_entry_array = chunks; flow_entry_array.start_index += tx.start_entry_index; - self.append_entries(flow_entry_array, &mut *merkle)?; + self.append_entries(flow_entry_array, &mut merkle)?; Ok(()) } @@ -203,7 +203,7 @@ impl LogStoreChunkWrite for LogManager { // TODO: Use another struct to avoid confusion. let mut flow_entry_array = chunks; flow_entry_array.start_index += tx.start_entry_index; - self.append_entries(flow_entry_array, &mut *merkle)?; + self.append_entries(flow_entry_array, &mut merkle)?; if let Some(file_proof) = maybe_file_proof { let updated_node_list = merkle.pora_chunks_merkle.fill_with_file_proof( @@ -258,7 +258,7 @@ impl LogStoreWrite for LogManager { } let maybe_same_data_tx_seq = self.tx_store.put_tx(tx.clone())?.first().cloned(); // TODO(zz): Should we validate received tx? - self.append_subtree_list(tx.merkle_nodes.clone(), &mut *merkle)?; + self.append_subtree_list(tx.merkle_nodes.clone(), &mut merkle)?; merkle.commit_merkle(tx.seq)?; debug!( "commit flow root: root={:?}", @@ -1041,7 +1041,7 @@ impl LogManager { for (_, offset) in &to_tx_offset_list { let mut data = batch_data.clone(); data.start_index += offset; - self.append_entries(data, &mut *merkle)?; + self.append_entries(data, &mut merkle)?; } } // num_entries() includes the rear padding data, so no need for more padding.