Skip to content

Commit

Permalink
chore(network): dead code attributes cleanup (#1831)
Browse files Browse the repository at this point in the history
  • Loading branch information
nagmo-starkware authored Mar 25, 2024
1 parent d487422 commit 57dffa7
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 17 deletions.
2 changes: 0 additions & 2 deletions crates/papyrus_network/src/db_executor/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,6 @@ pub enum DBExecutorError {
},
}

#[allow(dead_code)]
impl DBExecutorError {
pub fn query_id(&self) -> Option<QueryId> {
match self {
Expand Down Expand Up @@ -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() }
}
Expand Down
4 changes: 0 additions & 4 deletions crates/papyrus_network/src/streamed_bytes/behaviour.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<ToSwarm<Event, RequestFromBehaviourEvent>>,
pending_queries: DefaultHashMap<PeerId, Vec<(Bytes, OutboundSessionId)>>,
connection_ids_map: DefaultHashMap<PeerId, HashSet<ConnectionId>>,
session_id_to_peer_id_and_connection_id: HashMap<SessionId, (PeerId, ConnectionId)>,
next_outbound_session_id: OutboundSessionId,
Expand All @@ -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(),
Expand Down
6 changes: 0 additions & 6 deletions crates/papyrus_network/src/streamed_bytes/handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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 },
Expand Down Expand Up @@ -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<AtomicUsize>, peer_id: PeerId) -> Self {
Self {
config,
Expand Down
5 changes: 0 additions & 5 deletions crates/papyrus_network/src/test_utils/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,6 @@ impl<K: Unpin + Clone + Eq + Hash, V: StreamTrait + Unpin> StreamHashMap<K, V> {
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<K: Unpin + Clone + Eq + Hash, V: StreamTrait + Unpin> StreamTrait for StreamHashMap<K, V> {
Expand Down

0 comments on commit 57dffa7

Please sign in to comment.