@@ -7,8 +7,8 @@ use tokio::io::{AsyncRead, AsyncWrite};
7
7
use tokio:: time:: { timeout, Duration } ;
8
8
use tokio_io_timeout:: TimeoutStream ;
9
9
10
- use hyper:: { service:: Service , Uri } ;
11
10
use hyper:: client:: connect:: { Connect , Connected , Connection } ;
11
+ use hyper:: { service:: Service , Uri } ;
12
12
13
13
mod stream;
14
14
@@ -33,7 +33,7 @@ impl<T: Connect> TimeoutConnector<T> {
33
33
/// Construct a new TimeoutConnector with a given connector implementing the `Connect` trait
34
34
pub fn new ( connector : T ) -> Self {
35
35
TimeoutConnector {
36
- connector : connector ,
36
+ connector,
37
37
connect_timeout : None ,
38
38
read_timeout : None ,
39
39
write_timeout : None ,
@@ -50,15 +50,16 @@ where
50
50
{
51
51
type Response = Pin < Box < TimeoutConnectorStream < T :: Response > > > ;
52
52
type Error = BoxError ;
53
+ #[ allow( clippy:: type_complexity) ]
53
54
type Future = Pin < Box < dyn Future < Output = Result < Self :: Response , Self :: Error > > + Send > > ;
54
55
55
56
fn poll_ready ( & mut self , cx : & mut Context < ' _ > ) -> Poll < Result < ( ) , Self :: Error > > {
56
57
self . connector . poll_ready ( cx) . map_err ( Into :: into)
57
58
}
58
59
59
60
fn call ( & mut self , dst : Uri ) -> Self :: Future {
60
- let read_timeout = self . read_timeout . clone ( ) ;
61
- let write_timeout = self . write_timeout . clone ( ) ;
61
+ let read_timeout = self . read_timeout ;
62
+ let write_timeout = self . write_timeout ;
62
63
let connecting = self . connector . call ( dst) ;
63
64
64
65
if self . connect_timeout . is_none ( ) {
78
79
let timeout = timeout ( connect_timeout, connecting) ;
79
80
80
81
let fut = async move {
81
- let connecting = timeout. await . map_err ( |e| io:: Error :: new ( io:: ErrorKind :: TimedOut , e) ) ?;
82
+ let connecting = timeout
83
+ . await
84
+ . map_err ( |e| io:: Error :: new ( io:: ErrorKind :: TimedOut , e) ) ?;
82
85
let io = connecting. map_err ( Into :: into) ?;
83
86
84
87
let mut tm = TimeoutConnectorStream :: new ( TimeoutStream :: new ( io) ) ;
@@ -132,8 +135,8 @@ mod tests {
132
135
use std:: io;
133
136
use std:: time:: Duration ;
134
137
135
- use hyper:: Client ;
136
138
use hyper:: client:: HttpConnector ;
139
+ use hyper:: Client ;
137
140
138
141
use super :: TimeoutConnector ;
139
142
0 commit comments