fix clippy

This commit is contained in:
fakeshadow 2021-02-15 01:55:38 -08:00
parent cd1b0dd37a
commit 4accfc4d31
1 changed files with 15 additions and 11 deletions

View File

@ -232,16 +232,14 @@ where
// match the connection and spawn new one if did not get anything. // match the connection and spawn new one if did not get anything.
match conn { match conn {
Some(conn) => { Some(conn) => Ok(IoConnection::new(conn.conn, conn.created, acquired)),
Ok(IoConnection::new(conn.conn, conn.created.into(), acquired))
}
None => { None => {
let (io, proto) = connector.call(req).await?; let (io, proto) = connector.call(req).await?;
if proto == Protocol::Http1 { if proto == Protocol::Http1 {
Ok(IoConnection::new( Ok(IoConnection::new(
ConnectionType::H1(io), ConnectionType::H1(io),
Instant::now().into(), Instant::now(),
acquired, acquired,
)) ))
} else { } else {
@ -249,7 +247,7 @@ where
let (sender, connection) = handshake(io, config).await?; let (sender, connection) = handshake(io, config).await?;
Ok(IoConnection::new( Ok(IoConnection::new(
ConnectionType::H2(H2Connection::new(sender, connection)), ConnectionType::H2(H2Connection::new(sender, connection)),
Instant::now().into(), Instant::now(),
acquired, acquired,
)) ))
} }
@ -452,8 +450,10 @@ mod test {
generated: Rc::new(Cell::new(0)), generated: Rc::new(Cell::new(0)),
}; };
let mut config = ConnectorConfig::default(); let config = ConnectorConfig {
config.limit = 1; limit: 1,
..Default::default()
};
let pool = super::ConnectionPool::new(connector, config); let pool = super::ConnectionPool::new(connector, config);
@ -490,8 +490,10 @@ mod test {
let connector = TestPoolConnector { generated }; let connector = TestPoolConnector { generated };
let mut config = ConnectorConfig::default(); let config = ConnectorConfig {
config.conn_keep_alive = Duration::from_secs(1); conn_keep_alive: Duration::from_secs(1),
..Default::default()
};
let pool = super::ConnectionPool::new(connector, config); let pool = super::ConnectionPool::new(connector, config);
@ -529,8 +531,10 @@ mod test {
let connector = TestPoolConnector { generated }; let connector = TestPoolConnector { generated };
let mut config = ConnectorConfig::default(); let config = ConnectorConfig {
config.conn_lifetime = Duration::from_secs(1); conn_lifetime: Duration::from_secs(1),
..Default::default()
};
let pool = super::ConnectionPool::new(connector, config); let pool = super::ConnectionPool::new(connector, config);