From 81d46df244875a1052a7887fb2d67057e0812f5c Mon Sep 17 00:00:00 2001 From: Merkle Maren <266985194+merkle-maren@users.noreply.github.com> Date: Wed, 8 Apr 2026 09:06:01 +0000 Subject: [PATCH 1/2] Fixed clippy and compiler warnings across client and server crates --- client/http-client/src/tests.rs | 4 ++-- client/ws-client/src/tests.rs | 4 ++-- core/src/client/mod.rs | 12 ++++++++++++ server/src/server.rs | 2 +- 4 files changed, 17 insertions(+), 5 deletions(-) diff --git a/client/http-client/src/tests.rs b/client/http-client/src/tests.rs index f6af48e623..89ae695e9b 100644 --- a/client/http-client/src/tests.rs +++ b/client/http-client/src/tests.rs @@ -252,9 +252,9 @@ async fn batch_request_out_of_order_response() { } async fn run_batch_request_with_response( - batch: BatchRequestBuilder<'_>, + batch: BatchRequestBuilder<'static>, response: String, -) -> Result, ClientError> { +) -> Result, ClientError> { let server_addr = http_server_with_hardcoded_response(response).with_default_timeout().await.unwrap(); let uri = format!("http://{server_addr}"); let client = HttpClientBuilder::default().build(&uri).unwrap(); diff --git a/client/ws-client/src/tests.rs b/client/ws-client/src/tests.rs index eb0fd25110..91db7b2702 100644 --- a/client/ws-client/src/tests.rs +++ b/client/ws-client/src/tests.rs @@ -440,9 +440,9 @@ async fn is_connected_works() { } async fn run_batch_request_with_response( - batch: BatchRequestBuilder<'_>, + batch: BatchRequestBuilder<'static>, response: String, -) -> Result, Error> { +) -> Result, Error> { let server = WebSocketTestServer::with_hardcoded_response("127.0.0.1:0".parse().unwrap(), response) .with_default_timeout() .await diff --git a/core/src/client/mod.rs b/core/src/client/mod.rs index ff9371b9e8..6945add02d 100644 --- a/core/src/client/mod.rs +++ b/core/src/client/mod.rs @@ -63,6 +63,7 @@ pub(crate) struct SubscriptionLagged(Arc>); /// Owned version of [`RawResponse`]. pub type RawResponseOwned = RawResponse<'static>; +#[allow(dead_code)] impl SubscriptionLagged { /// Create a new [`SubscriptionLagged`]. pub(crate) fn new() -> Self { @@ -288,6 +289,7 @@ pub struct Subscription { // but type type has no need to be pinned. impl std::marker::Unpin for Subscription {} +#[allow(dead_code)] impl Subscription { /// Create a new subscription. fn new(to_back: mpsc::Sender, rx: SubscriptionReceiver, kind: SubscriptionKind) -> Self { @@ -333,6 +335,7 @@ impl Subscription { /// Batch request message. #[derive(Debug)] +#[allow(dead_code)] struct BatchMessage { /// Serialized batch request. raw: String, @@ -344,6 +347,7 @@ struct BatchMessage { /// Request message. #[derive(Debug)] +#[allow(dead_code)] struct RequestMessage { /// Serialized message. raw: String, @@ -355,6 +359,7 @@ struct RequestMessage { /// Subscription message. #[derive(Debug)] +#[allow(dead_code)] struct SubscriptionMessage { /// Serialized message. raw: String, @@ -372,6 +377,7 @@ struct SubscriptionMessage { /// RegisterNotification message. #[derive(Debug)] +#[allow(dead_code)] struct RegisterNotificationMessage { /// Method name this notification handler is attached to method: String, @@ -383,6 +389,7 @@ struct RegisterNotificationMessage { /// Message that the Client can send to the background task. #[derive(Debug)] +#[allow(dead_code)] enum FrontToBack { /// Send a batch request to the server. Batch(BatchMessage), @@ -606,6 +613,7 @@ impl<'a, R> IntoIterator for BatchResponse<'a, R> { } #[derive(thiserror::Error, Debug)] +#[allow(dead_code)] enum TrySubscriptionSendError { #[error("The subscription is closed")] Closed, @@ -614,11 +622,13 @@ enum TrySubscriptionSendError { } #[derive(Debug)] +#[allow(dead_code)] pub(crate) struct SubscriptionSender { inner: mpsc::Sender>, lagged: SubscriptionLagged, } +#[allow(dead_code)] impl SubscriptionSender { fn send(&self, msg: Box) -> Result<(), TrySubscriptionSendError> { match self.inner.try_send(msg) { @@ -646,6 +656,7 @@ impl Stream for SubscriptionReceiver { } } +#[allow(dead_code)] fn subscription_channel(max_buf_size: usize) -> (SubscriptionSender, SubscriptionReceiver) { let (tx, rx) = mpsc::channel(max_buf_size); let lagged_tx = SubscriptionLagged::new(); @@ -661,6 +672,7 @@ pub struct SubscriptionResponse { sub_id: SubscriptionId<'static>, // The receiver is used to receive notifications from the server and shouldn't be exposed to the user // from the middleware. + #[allow(dead_code)] stream: SubscriptionReceiver, } diff --git a/server/src/server.rs b/server/src/server.rs index 87d2316149..52617a78c9 100644 --- a/server/src/server.rs +++ b/server/src/server.rs @@ -1163,7 +1163,7 @@ struct ProcessConnection<'a, HttpMiddleware, RpcMiddleware> { } #[instrument(name = "connection", skip_all, fields(remote_addr = %params.remote_addr, conn_id = %params.conn_id), level = "INFO")] -fn process_connection<'a, RpcMiddleware, HttpMiddleware, Body>(params: ProcessConnection) +fn process_connection(params: ProcessConnection) where HttpMiddleware: Layer> + Send + 'static, >>::Service: From bf2b6f815ad91c0f9bb7ca0fe21276c582afb62a Mon Sep 17 00:00:00 2001 From: Merkle Maren <266985194+merkle-maren@users.noreply.github.com> Date: Thu, 9 Apr 2026 14:11:11 +0000 Subject: [PATCH 2/2] PR review comments --- client/http-client/src/tests.rs | 6 +++--- client/ws-client/src/tests.rs | 6 +++--- core/src/client/mod.rs | 12 ------------ 3 files changed, 6 insertions(+), 18 deletions(-) diff --git a/client/http-client/src/tests.rs b/client/http-client/src/tests.rs index 89ae695e9b..813be5f876 100644 --- a/client/http-client/src/tests.rs +++ b/client/http-client/src/tests.rs @@ -251,10 +251,10 @@ async fn batch_request_out_of_order_response() { assert_eq!(response, vec!["hello".to_string(), "goodbye".to_string(), "here's your swag".to_string()]); } -async fn run_batch_request_with_response( - batch: BatchRequestBuilder<'static>, +async fn run_batch_request_with_response<'a, T: Send + DeserializeOwned + std::fmt::Debug + Clone + 'static>( + batch: BatchRequestBuilder<'a>, response: String, -) -> Result, ClientError> { +) -> Result, ClientError> { let server_addr = http_server_with_hardcoded_response(response).with_default_timeout().await.unwrap(); let uri = format!("http://{server_addr}"); let client = HttpClientBuilder::default().build(&uri).unwrap(); diff --git a/client/ws-client/src/tests.rs b/client/ws-client/src/tests.rs index 91db7b2702..18db7da0fa 100644 --- a/client/ws-client/src/tests.rs +++ b/client/ws-client/src/tests.rs @@ -439,10 +439,10 @@ async fn is_connected_works() { assert!(!client.is_connected()) } -async fn run_batch_request_with_response( - batch: BatchRequestBuilder<'static>, +async fn run_batch_request_with_response<'a, T: Send + DeserializeOwned + std::fmt::Debug + Clone + 'static>( + batch: BatchRequestBuilder<'a>, response: String, -) -> Result, Error> { +) -> Result, Error> { let server = WebSocketTestServer::with_hardcoded_response("127.0.0.1:0".parse().unwrap(), response) .with_default_timeout() .await diff --git a/core/src/client/mod.rs b/core/src/client/mod.rs index 6945add02d..ff9371b9e8 100644 --- a/core/src/client/mod.rs +++ b/core/src/client/mod.rs @@ -63,7 +63,6 @@ pub(crate) struct SubscriptionLagged(Arc>); /// Owned version of [`RawResponse`]. pub type RawResponseOwned = RawResponse<'static>; -#[allow(dead_code)] impl SubscriptionLagged { /// Create a new [`SubscriptionLagged`]. pub(crate) fn new() -> Self { @@ -289,7 +288,6 @@ pub struct Subscription { // but type type has no need to be pinned. impl std::marker::Unpin for Subscription {} -#[allow(dead_code)] impl Subscription { /// Create a new subscription. fn new(to_back: mpsc::Sender, rx: SubscriptionReceiver, kind: SubscriptionKind) -> Self { @@ -335,7 +333,6 @@ impl Subscription { /// Batch request message. #[derive(Debug)] -#[allow(dead_code)] struct BatchMessage { /// Serialized batch request. raw: String, @@ -347,7 +344,6 @@ struct BatchMessage { /// Request message. #[derive(Debug)] -#[allow(dead_code)] struct RequestMessage { /// Serialized message. raw: String, @@ -359,7 +355,6 @@ struct RequestMessage { /// Subscription message. #[derive(Debug)] -#[allow(dead_code)] struct SubscriptionMessage { /// Serialized message. raw: String, @@ -377,7 +372,6 @@ struct SubscriptionMessage { /// RegisterNotification message. #[derive(Debug)] -#[allow(dead_code)] struct RegisterNotificationMessage { /// Method name this notification handler is attached to method: String, @@ -389,7 +383,6 @@ struct RegisterNotificationMessage { /// Message that the Client can send to the background task. #[derive(Debug)] -#[allow(dead_code)] enum FrontToBack { /// Send a batch request to the server. Batch(BatchMessage), @@ -613,7 +606,6 @@ impl<'a, R> IntoIterator for BatchResponse<'a, R> { } #[derive(thiserror::Error, Debug)] -#[allow(dead_code)] enum TrySubscriptionSendError { #[error("The subscription is closed")] Closed, @@ -622,13 +614,11 @@ enum TrySubscriptionSendError { } #[derive(Debug)] -#[allow(dead_code)] pub(crate) struct SubscriptionSender { inner: mpsc::Sender>, lagged: SubscriptionLagged, } -#[allow(dead_code)] impl SubscriptionSender { fn send(&self, msg: Box) -> Result<(), TrySubscriptionSendError> { match self.inner.try_send(msg) { @@ -656,7 +646,6 @@ impl Stream for SubscriptionReceiver { } } -#[allow(dead_code)] fn subscription_channel(max_buf_size: usize) -> (SubscriptionSender, SubscriptionReceiver) { let (tx, rx) = mpsc::channel(max_buf_size); let lagged_tx = SubscriptionLagged::new(); @@ -672,7 +661,6 @@ pub struct SubscriptionResponse { sub_id: SubscriptionId<'static>, // The receiver is used to receive notifications from the server and shouldn't be exposed to the user // from the middleware. - #[allow(dead_code)] stream: SubscriptionReceiver, }