Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions client/http-client/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -252,9 +252,9 @@ async fn batch_request_out_of_order_response() {
}

async fn run_batch_request_with_response<T: Send + DeserializeOwned + std::fmt::Debug + Clone + 'static>(
batch: BatchRequestBuilder<'_>,
batch: BatchRequestBuilder<'static>,

@jsdw jsdw Apr 8, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would have thought that adding '_ fo the BatchResponse type would also work here, but the proper equivalent would be adding a 'a lifetime in the generic params and using that. Elided / unnamed lifetimes aren't the same as static lifetimes.

response: String,
) -> Result<BatchResponse<T>, ClientError> {
) -> Result<BatchResponse<'static, T>, 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();
Expand Down
4 changes: 2 additions & 2 deletions client/ws-client/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -440,9 +440,9 @@ async fn is_connected_works() {
}

async fn run_batch_request_with_response<T: Send + DeserializeOwned + std::fmt::Debug + Clone + 'static>(
batch: BatchRequestBuilder<'_>,
batch: BatchRequestBuilder<'static>,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As above

response: String,
) -> Result<BatchResponse<T>, Error> {
) -> Result<BatchResponse<'static, T>, Error> {
let server = WebSocketTestServer::with_hardcoded_response("127.0.0.1:0".parse().unwrap(), response)
.with_default_timeout()
.await
Expand Down
12 changes: 12 additions & 0 deletions core/src/client/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ pub(crate) struct SubscriptionLagged(Arc<RwLock<bool>>);
/// Owned version of [`RawResponse`].
pub type RawResponseOwned = RawResponse<'static>;

#[allow(dead_code)]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All of these #[allow(dead_code)]s I would guess (without checking myself) are feature flag related, and the relevant things should be hidden when the feature(s) they are used for aren't enabled, rather then ignored via dead_code (which might legitimately mean they aren't needed anywhere)

impl SubscriptionLagged {
/// Create a new [`SubscriptionLagged`].
pub(crate) fn new() -> Self {
Expand Down Expand Up @@ -288,6 +289,7 @@ pub struct Subscription<Notif> {
// but type type has no need to be pinned.
impl<Notif> std::marker::Unpin for Subscription<Notif> {}

#[allow(dead_code)]
impl<Notif> Subscription<Notif> {
/// Create a new subscription.
fn new(to_back: mpsc::Sender<FrontToBack>, rx: SubscriptionReceiver, kind: SubscriptionKind) -> Self {
Expand Down Expand Up @@ -333,6 +335,7 @@ impl<Notif> Subscription<Notif> {

/// Batch request message.
#[derive(Debug)]
#[allow(dead_code)]
struct BatchMessage {
/// Serialized batch request.
raw: String,
Expand All @@ -344,6 +347,7 @@ struct BatchMessage {

/// Request message.
#[derive(Debug)]
#[allow(dead_code)]
struct RequestMessage {
/// Serialized message.
raw: String,
Expand All @@ -355,6 +359,7 @@ struct RequestMessage {

/// Subscription message.
#[derive(Debug)]
#[allow(dead_code)]
struct SubscriptionMessage {
/// Serialized message.
raw: String,
Expand All @@ -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,
Expand All @@ -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),
Expand Down Expand Up @@ -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,
Expand All @@ -614,11 +622,13 @@ enum TrySubscriptionSendError {
}

#[derive(Debug)]
#[allow(dead_code)]
pub(crate) struct SubscriptionSender {
inner: mpsc::Sender<Box<RawValue>>,
lagged: SubscriptionLagged,
}

#[allow(dead_code)]
impl SubscriptionSender {
fn send(&self, msg: Box<RawValue>) -> Result<(), TrySubscriptionSendError> {
match self.inner.try_send(msg) {
Expand Down Expand Up @@ -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();
Expand All @@ -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,
}

Expand Down
2 changes: 1 addition & 1 deletion server/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<HttpMiddleware, RpcMiddleware>)
fn process_connection<RpcMiddleware, HttpMiddleware, Body>(params: ProcessConnection<HttpMiddleware, RpcMiddleware>)
where
HttpMiddleware: Layer<TowerServiceNoHttp<RpcMiddleware>> + Send + 'static,
<HttpMiddleware as Layer<TowerServiceNoHttp<RpcMiddleware>>>::Service:
Expand Down