From e6811e8818b015c31f88d22bd037d3377deac1c3 Mon Sep 17 00:00:00 2001 From: Aaron Hill Date: Wed, 19 Feb 2020 21:03:53 -0500 Subject: [PATCH] Use #[pin_project] with `ConnectorPoolSupport` This removes a use of `Pin::get_unchecked_mut` --- actix-http/src/client/pool.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/actix-http/src/client/pool.rs b/actix-http/src/client/pool.rs index 8c94423a..139cf9f6 100644 --- a/actix-http/src/client/pool.rs +++ b/actix-http/src/client/pool.rs @@ -17,6 +17,7 @@ use h2::client::{handshake, Connection, SendRequest}; use http::uri::Authority; use indexmap::IndexSet; use slab::Slab; +use pin_project::pin_project; use super::connection::{ConnectionType, IoConnection}; use super::error::ConnectError; @@ -422,6 +423,7 @@ where } } +#[pin_project] struct ConnectorPoolSupport where Io: AsyncRead + AsyncWrite + Unpin + 'static, @@ -439,7 +441,7 @@ where type Output = (); fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll { - let this = unsafe { self.get_unchecked_mut() }; + let this = self.project(); let mut inner = this.inner.as_ref().borrow_mut(); inner.waker.register(cx.waker());