style(lib): address most clippy lints

This commit is contained in:
danieleades
2020-01-03 17:40:32 +00:00
committed by Sean McArthur
parent 0f13719873
commit 0eaf304644
29 changed files with 162 additions and 200 deletions

View File

@@ -542,7 +542,7 @@ impl ConnectingTcpRemote {
}
}
return Err(err.take().expect("missing connect error"));
Err(err.take().expect("missing connect error"))
}
}
@@ -552,9 +552,9 @@ fn connect(
reuse_address: bool,
connect_timeout: Option<Duration>,
) -> io::Result<impl Future<Output = io::Result<TcpStream>>> {
let builder = match addr {
&SocketAddr::V4(_) => TcpBuilder::new_v4()?,
&SocketAddr::V6(_) => TcpBuilder::new_v6()?,
let builder = match *addr {
SocketAddr::V4(_) => TcpBuilder::new_v4()?,
SocketAddr::V6(_) => TcpBuilder::new_v6()?,
};
if reuse_address {
@@ -566,9 +566,9 @@ fn connect(
builder.bind(SocketAddr::new(local_addr.clone(), 0))?;
} else if cfg!(windows) {
// Windows requires a socket be bound before calling connect
let any: SocketAddr = match addr {
&SocketAddr::V4(_) => ([0, 0, 0, 0], 0).into(),
&SocketAddr::V6(_) => ([0, 0, 0, 0, 0, 0, 0, 0], 0).into(),
let any: SocketAddr = match *addr {
SocketAddr::V4(_) => ([0, 0, 0, 0], 0).into(),
SocketAddr::V6(_) => ([0, 0, 0, 0, 0, 0, 0, 0], 0).into(),
};
builder.bind(any)?;
}
@@ -619,7 +619,7 @@ impl ConnectingTcp {
}
};
if let Err(_) = result {
if result.is_err() {
// Fallback to the remaining future (could be preferred or fallback)
// if we get an error
future.await