Skip to content

Commit 6197302

Browse files
committed
Remove Boxing
Waiting on rust-lang/rust#63063.
1 parent 325c5d8 commit 6197302

File tree

3 files changed

+11
-10
lines changed

3 files changed

+11
-10
lines changed

src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
//! the client helper as `Client` in the protocol module you're working with (e.g.,
3838
//! [`pipeline::Client`]), and the server helper as `Server` in the same place.
3939
#![deny(missing_docs)]
40+
#![feature(type_alias_impl_trait)]
4041

4142
const YIELD_EVERY: usize = 24;
4243

src/multiplex/client.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,11 @@ where
8585
{
8686
type Error = SpawnError<NT::MakeError>;
8787
type Response = Client<NT::Transport, Error<NT::Transport, Request>, Request>;
88-
type Future = Pin<Box<dyn Future<Output = Result<Self::Response, Self::Error>> + Send>>;
88+
type Future = impl Future<Output = Result<Self::Response, Self::Error>> + Send;
8989

9090
fn call(&mut self, target: Target) -> Self::Future {
9191
let maker = self.t_maker.make_transport(target);
92-
Box::pin(async move { Ok(Client::new(maker.await.map_err(SpawnError::Inner)?)) })
92+
async move { Ok(Client::new(maker.await.map_err(SpawnError::Inner)?)) }
9393
}
9494

9595
fn poll_ready(&mut self, cx: &mut Context) -> Poll<Result<(), Self::Error>> {
@@ -369,7 +369,7 @@ where
369369
{
370370
type Response = T::Ok;
371371
type Error = E;
372-
type Future = Pin<Box<dyn Future<Output = Result<Self::Response, Self::Error>> + Send>>;
372+
type Future = impl Future<Output = Result<Self::Response, Self::Error>> + Send;
373373

374374
fn poll_ready(&mut self, cx: &mut Context) -> Poll<Result<(), E>> {
375375
Poll::Ready(ready!(self.mediator.poll_ready(cx)).map_err(|_| E::from(Error::ClientDropped)))
@@ -384,7 +384,7 @@ where
384384
event!(span, Level::TRACE, "issuing request");
385385
let req = ClientRequest { req, span, res: tx };
386386
let r = self.mediator.try_send(req);
387-
Box::pin(async move {
387+
async move {
388388
match r {
389389
Ok(()) => match rx.await {
390390
Ok(r) => {
@@ -396,7 +396,7 @@ where
396396
},
397397
Err(_) => Err(E::from(Error::TransportFull)),
398398
}
399-
})
399+
}
400400
}
401401
}
402402

src/pipeline/client.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,11 @@ where
6464
{
6565
type Error = SpawnError<NT::MakeError>;
6666
type Response = Client<NT::Transport, Error<NT::Transport, Request>, Request>;
67-
type Future = Pin<Box<dyn Future<Output = Result<Self::Response, Self::Error>> + Send>>;
67+
type Future = impl Future<Output = Result<Self::Response, Self::Error>> + Send;
6868

6969
fn call(&mut self, target: Target) -> Self::Future {
7070
let maker = self.t_maker.make_transport(target);
71-
Box::pin(async move { Ok(Client::new(maker.await.map_err(SpawnError::Inner)?)) })
71+
async move { Ok(Client::new(maker.await.map_err(SpawnError::Inner)?)) }
7272
}
7373

7474
fn poll_ready(&mut self, cx: &mut Context) -> Poll<Result<(), Self::Error>> {
@@ -332,7 +332,7 @@ where
332332
{
333333
type Response = T::Ok;
334334
type Error = E;
335-
type Future = Pin<Box<dyn Future<Output = Result<Self::Response, Self::Error>> + Send>>;
335+
type Future = impl Future<Output = Result<Self::Response, Self::Error>> + Send;
336336

337337
fn poll_ready(&mut self, cx: &mut Context) -> Poll<Result<(), E>> {
338338
Poll::Ready(ready!(self.mediator.poll_ready(cx)).map_err(|_| E::from(Error::ClientDropped)))
@@ -347,7 +347,7 @@ where
347347
event!(span, Level::TRACE, "issuing request");
348348
let req = ClientRequest { req, span, res: tx };
349349
let r = self.mediator.try_send(req);
350-
Box::pin(async move {
350+
async move {
351351
match r {
352352
Ok(()) => match rx.await {
353353
Ok(r) => {
@@ -359,7 +359,7 @@ where
359359
},
360360
Err(_) => Err(E::from(Error::TransportFull)),
361361
}
362-
})
362+
}
363363
}
364364
}
365365

0 commit comments

Comments
 (0)