chore: Implement latest clippy warnings (#3220)

As I do frequently, I corrected for the latest clippy warnings. This will make sure the CI won't complain in the future. We could automate this btw and maybe run the nightly version of clippy.
This commit is contained in:
Hannes
2022-12-14 16:45:04 +01:00
committed by GitHub
parent be3ec6c62b
commit d79c93abdb
72 changed files with 244 additions and 307 deletions

View File

@ -44,13 +44,13 @@ pub enum Error<E> {
impl<E: fmt::Display> fmt::Display for Error<E> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Error::Transport(err) => write!(f, "{}", err),
Error::Tls(err) => write!(f, "{}", err),
Error::Handshake(err) => write!(f, "{}", err),
Error::InvalidMultiaddr(ma) => write!(f, "invalid multi-address: {}", ma),
Error::Transport(err) => write!(f, "{err}"),
Error::Tls(err) => write!(f, "{err}"),
Error::Handshake(err) => write!(f, "{err}"),
Error::InvalidMultiaddr(ma) => write!(f, "invalid multi-address: {ma}"),
Error::TooManyRedirects => f.write_str("too many redirects"),
Error::InvalidRedirectLocation => f.write_str("invalid redirect location"),
Error::Base(err) => write!(f, "{}", err),
Error::Base(err) => write!(f, "{err}"),
}
}
}

View File

@ -381,7 +381,7 @@ where
Ok(Either::Left(location))
}
handshake::ServerResponse::Rejected { status_code } => {
let msg = format!("server rejected handshake; status code = {}", status_code);
let msg = format!("server rejected handshake; status code = {status_code}");
Err(Error::Handshake(msg.into()))
}
handshake::ServerResponse::Accepted { .. } => {
@ -501,10 +501,10 @@ fn parse_ws_dial_addr<T>(addr: Multiaddr) -> Result<WsAddress, Error<T>> {
let (host_port, dns_name) = loop {
match (ip, tcp) {
(Some(Protocol::Ip4(ip)), Some(Protocol::Tcp(port))) => {
break (format!("{}:{}", ip, port), None)
break (format!("{ip}:{port}"), None)
}
(Some(Protocol::Ip6(ip)), Some(Protocol::Tcp(port))) => {
break (format!("{}:{}", ip, port), None)
break (format!("{ip}:{port}"), None)
}
(Some(Protocol::Dns(h)), Some(Protocol::Tcp(port)))
| (Some(Protocol::Dns4(h)), Some(Protocol::Tcp(port)))

View File

@ -167,9 +167,9 @@ pub enum Error {
impl fmt::Display for Error {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Error::Io(e) => write!(f, "i/o error: {}", e),
Error::Tls(e) => write!(f, "tls error: {}", e),
Error::InvalidDnsName(n) => write!(f, "invalid DNS name: {}", n),
Error::Io(e) => write!(f, "i/o error: {e}"),
Error::Tls(e) => write!(f, "tls error: {e}"),
Error::InvalidDnsName(n) => write!(f, "invalid DNS name: {n}"),
}
}
}