From 57dffa7983710336832bc30492070b0c46df8247 Mon Sep 17 00:00:00 2001 From: nagmo-starkware <127658633+nagmo-starkware@users.noreply.github.com> Date: Mon, 25 Mar 2024 11:16:57 +0200 Subject: [PATCH] chore(network): dead code attributes cleanup (#1831) --- crates/papyrus_network/src/db_executor/mod.rs | 2 -- crates/papyrus_network/src/streamed_bytes/behaviour.rs | 4 ---- crates/papyrus_network/src/streamed_bytes/handler.rs | 6 ------ crates/papyrus_network/src/test_utils/mod.rs | 5 ----- 4 files changed, 17 deletions(-) diff --git a/crates/papyrus_network/src/db_executor/mod.rs b/crates/papyrus_network/src/db_executor/mod.rs index 2938a4a41b..50c746e0cd 100644 --- a/crates/papyrus_network/src/db_executor/mod.rs +++ b/crates/papyrus_network/src/db_executor/mod.rs @@ -130,7 +130,6 @@ pub enum DBExecutorError { }, } -#[allow(dead_code)] impl DBExecutorError { pub fn query_id(&self) -> Option { match self { @@ -174,7 +173,6 @@ pub struct BlockHeaderDBExecutor { } impl BlockHeaderDBExecutor { - #[allow(dead_code)] pub fn new(storage_reader: StorageReader) -> Self { Self { next_query_id: 0, storage_reader, query_execution_set: FuturesUnordered::new() } } diff --git a/crates/papyrus_network/src/streamed_bytes/behaviour.rs b/crates/papyrus_network/src/streamed_bytes/behaviour.rs index 078a2165b2..fe628fafe2 100644 --- a/crates/papyrus_network/src/streamed_bytes/behaviour.rs +++ b/crates/papyrus_network/src/streamed_bytes/behaviour.rs @@ -99,12 +99,9 @@ pub struct SessionIdNotFoundError; #[error("We are not connected to the given peer. Dial to the given peer and try again.")] pub struct PeerNotConnected; -// TODO(shahak) remove allow dead code. -#[allow(dead_code)] pub struct Behaviour { config: Config, pending_events: VecDeque>, - pending_queries: DefaultHashMap>, connection_ids_map: DefaultHashMap>, session_id_to_peer_id_and_connection_id: HashMap, next_outbound_session_id: OutboundSessionId, @@ -118,7 +115,6 @@ impl Behaviour { Self { config, pending_events: Default::default(), - pending_queries: Default::default(), connection_ids_map: Default::default(), session_id_to_peer_id_and_connection_id: Default::default(), next_outbound_session_id: Default::default(), diff --git a/crates/papyrus_network/src/streamed_bytes/handler.rs b/crates/papyrus_network/src/streamed_bytes/handler.rs index 647ead6ba9..71a98e4787 100644 --- a/crates/papyrus_network/src/streamed_bytes/handler.rs +++ b/crates/papyrus_network/src/streamed_bytes/handler.rs @@ -35,8 +35,6 @@ use super::protocol::{InboundProtocol, OutboundProtocol}; use super::{Bytes, Config, GenericEvent, InboundSessionId, OutboundSessionId, SessionId}; #[derive(Debug)] -// TODO(shahak) remove allow(dead_code). -#[allow(dead_code)] pub enum RequestFromBehaviourEvent { CreateOutboundSession { query: Bytes, @@ -62,8 +60,6 @@ pub enum RequestToBehaviourEvent { } #[derive(thiserror::Error, Debug)] -// TODO(shahak) remove allow(dead_code). -#[allow(dead_code)] pub enum SessionError { #[error("Connection timed out after {} seconds.", session_timeout.as_secs())] Timeout { session_timeout: Duration }, @@ -99,8 +95,6 @@ pub struct Handler { impl Handler { // TODO(shahak) If we'll add more parameters, consider creating a HandlerConfig struct. - // TODO(shahak) remove allow(dead_code). - #[allow(dead_code)] pub fn new(config: Config, next_inbound_session_id: Arc, peer_id: PeerId) -> Self { Self { config, diff --git a/crates/papyrus_network/src/test_utils/mod.rs b/crates/papyrus_network/src/test_utils/mod.rs index 0ec75132b8..6f931e2a7a 100644 --- a/crates/papyrus_network/src/test_utils/mod.rs +++ b/crates/papyrus_network/src/test_utils/mod.rs @@ -74,11 +74,6 @@ impl StreamHashMap { pub fn keys(&self) -> Keys<'_, K, V> { self.map.keys() } - - #[allow(dead_code)] - pub fn get_mut(&mut self, key: &K) -> Option<&mut V> { - self.map.get_mut(key) - } } impl StreamTrait for StreamHashMap {