From d06d3995608bd427299c45d1dd8ef82610c60e68 Mon Sep 17 00:00:00 2001 From: Itay Tsabary Date: Sun, 17 Nov 2024 16:34:23 +0200 Subject: [PATCH] chore(sequencer_infra): remove redundant clones commit-id:8a20078e --- .../src/component_client/remote_component_client.rs | 3 +-- .../src/component_server/local_component_server.rs | 2 +- .../src/component_server/remote_component_server.rs | 2 +- crates/starknet_sequencer_infra/src/tests/mod.rs | 8 ++++---- 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/crates/starknet_sequencer_infra/src/component_client/remote_component_client.rs b/crates/starknet_sequencer_infra/src/component_client/remote_component_client.rs index 5786f03947..bb1cbc4c22 100644 --- a/crates/starknet_sequencer_infra/src/component_client/remote_component_client.rs +++ b/crates/starknet_sequencer_infra/src/component_client/remote_component_client.rs @@ -41,7 +41,7 @@ use crate::serde_utils::BincodeSerdeWrapper; /// }; /// /// // Define your request and response types -/// #[derive(Serialize, Deserialize, Debug, Clone)] +/// #[derive(Serialize, Deserialize, Debug)] /// struct MyRequest { /// pub content: String, /// } @@ -134,7 +134,6 @@ where } } -// TODO(Tsabary): remove clone trait from request and response, throughout. #[async_trait] impl ComponentClient for RemoteComponentClient diff --git a/crates/starknet_sequencer_infra/src/component_server/local_component_server.rs b/crates/starknet_sequencer_infra/src/component_server/local_component_server.rs index 8111155281..eeb4f02597 100644 --- a/crates/starknet_sequencer_infra/src/component_server/local_component_server.rs +++ b/crates/starknet_sequencer_infra/src/component_server/local_component_server.rs @@ -75,7 +75,7 @@ use crate::errors::{ComponentServerError, ReplaceComponentError}; /// #[async_trait] /// impl ComponentRequestHandler for MyComponent { /// async fn handle_request(&mut self, request: MyRequest) -> MyResponse { -/// MyResponse { content: request.content.clone() + " processed" } +/// MyResponse { content: request.content + " processed" } /// } /// } /// diff --git a/crates/starknet_sequencer_infra/src/component_server/remote_component_server.rs b/crates/starknet_sequencer_infra/src/component_server/remote_component_server.rs index bbca70a5ed..9b4b97584e 100644 --- a/crates/starknet_sequencer_infra/src/component_server/remote_component_server.rs +++ b/crates/starknet_sequencer_infra/src/component_server/remote_component_server.rs @@ -80,7 +80,7 @@ use crate::serde_utils::BincodeSerdeWrapper; /// #[async_trait] /// impl ComponentRequestHandler for MyComponent { /// async fn handle_request(&mut self, request: MyRequest) -> MyResponse { -/// MyResponse { content: request.content.clone() + " processed" } +/// MyResponse { content: request.content + " processed" } /// } /// } /// diff --git a/crates/starknet_sequencer_infra/src/tests/mod.rs b/crates/starknet_sequencer_infra/src/tests/mod.rs index dba31e2ce1..add9ec8de0 100644 --- a/crates/starknet_sequencer_infra/src/tests/mod.rs +++ b/crates/starknet_sequencer_infra/src/tests/mod.rs @@ -11,23 +11,23 @@ pub(crate) type ValueB = Felt; pub(crate) type ResultA = ClientResult; pub(crate) type ResultB = ClientResult; -#[derive(Serialize, Deserialize, Debug, Clone)] +#[derive(Serialize, Deserialize, Debug)] pub enum ComponentARequest { AGetValue, } -#[derive(Serialize, Deserialize, Debug, Clone)] +#[derive(Serialize, Deserialize, Debug)] pub enum ComponentAResponse { AGetValue(ValueA), } -#[derive(Serialize, Deserialize, Debug, Clone)] +#[derive(Serialize, Deserialize, Debug)] pub enum ComponentBRequest { BGetValue, BSetValue(ValueB), } -#[derive(Serialize, Deserialize, Debug, Clone)] +#[derive(Serialize, Deserialize, Debug)] pub enum ComponentBResponse { BGetValue(ValueB), BSetValue,