Skip to content

Commit 78d8d0a

Browse files
committed
chore!: remove Service impls for &T
Remove an unused and unusable layer of indirection, as we require `Transport: 'static`.
1 parent 89f507c commit 78d8d0a

File tree

3 files changed

+2
-54
lines changed

3 files changed

+2
-54
lines changed

Diff for: crates/pubsub/src/frontend.rs

-16
Original file line numberDiff line numberDiff line change
@@ -108,22 +108,6 @@ impl tower::Service<RequestPacket> for PubSubFrontend {
108108
type Error = TransportError;
109109
type Future = TransportFut<'static>;
110110

111-
#[inline]
112-
fn poll_ready(&mut self, cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>> {
113-
(&*self).poll_ready(cx)
114-
}
115-
116-
#[inline]
117-
fn call(&mut self, req: RequestPacket) -> Self::Future {
118-
(&*self).call(req)
119-
}
120-
}
121-
122-
impl tower::Service<RequestPacket> for &PubSubFrontend {
123-
type Response = ResponsePacket;
124-
type Error = TransportError;
125-
type Future = TransportFut<'static>;
126-
127111
#[inline]
128112
fn poll_ready(&mut self, _cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>> {
129113
let result =

Diff for: crates/transport-http/src/hyper_transport.rs

+1-22
Original file line numberDiff line numberDiff line change
@@ -154,34 +154,13 @@ where
154154
type Error = TransportError;
155155
type Future = TransportFut<'static>;
156156

157-
#[inline]
158-
fn poll_ready(&mut self, cx: &mut task::Context<'_>) -> task::Poll<Result<(), Self::Error>> {
159-
(&*self).poll_ready(cx)
160-
}
161-
162-
#[inline]
163-
fn call(&mut self, req: RequestPacket) -> Self::Future {
164-
(&*self).call(req)
165-
}
166-
}
167-
168-
impl<B, S> Service<RequestPacket> for &Http<HyperClient<B, S>>
169-
where
170-
S: Service<Request<B>, Response = HyperResponse> + Clone + Send + Sync + 'static,
171-
S::Future: Send,
172-
S::Error: std::error::Error + Send + Sync + 'static,
173-
B: From<Vec<u8>> + Send + 'static + Clone + Sync,
174-
{
175-
type Response = ResponsePacket;
176-
type Error = TransportError;
177-
type Future = TransportFut<'static>;
178-
179157
#[inline]
180158
fn poll_ready(&mut self, _cx: &mut task::Context<'_>) -> task::Poll<Result<(), Self::Error>> {
181159
// `hyper` always returns `Ok(())`.
182160
task::Poll::Ready(Ok(()))
183161
}
184162

163+
#[inline]
185164
fn call(&mut self, req: RequestPacket) -> Self::Future {
186165
let this = self.clone();
187166
let span = debug_span!("HyperTransport", url = %this.url);

Diff for: crates/transport-http/src/reqwest_transport.rs

+1-16
Original file line numberDiff line numberDiff line change
@@ -74,28 +74,13 @@ impl Service<RequestPacket> for Http<reqwest::Client> {
7474
type Error = TransportError;
7575
type Future = TransportFut<'static>;
7676

77-
#[inline]
78-
fn poll_ready(&mut self, cx: &mut task::Context<'_>) -> task::Poll<Result<(), Self::Error>> {
79-
(&*self).poll_ready(cx)
80-
}
81-
82-
#[inline]
83-
fn call(&mut self, req: RequestPacket) -> Self::Future {
84-
(&*self).call(req)
85-
}
86-
}
87-
88-
impl Service<RequestPacket> for &Http<reqwest::Client> {
89-
type Response = ResponsePacket;
90-
type Error = TransportError;
91-
type Future = TransportFut<'static>;
92-
9377
#[inline]
9478
fn poll_ready(&mut self, _cx: &mut task::Context<'_>) -> task::Poll<Result<(), Self::Error>> {
9579
// `reqwest` always returns `Ok(())`.
9680
task::Poll::Ready(Ok(()))
9781
}
9882

83+
#[inline]
9984
fn call(&mut self, req: RequestPacket) -> Self::Future {
10085
let this = self.clone();
10186
let span = debug_span!("ReqwestTransport", url = %this.url);

0 commit comments

Comments
 (0)