style(lib): use rust 2018 edition idioms (#1910)

This commit is contained in:
lzutao
2019-08-22 01:22:07 +07:00
committed by Sean McArthur
parent ae75b3a732
commit fc7f81b67c
38 changed files with 90 additions and 146 deletions

View File

@@ -75,13 +75,13 @@ impl Name {
}
impl fmt::Debug for Name {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt::Debug::fmt(&self.host, f)
}
}
impl fmt::Display for Name {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt::Display::fmt(&self.host, f)
}
}
@@ -100,7 +100,7 @@ impl FromStr for Name {
pub struct InvalidNameError(());
impl fmt::Display for InvalidNameError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.write_str("Not a valid domain name")
}
}
@@ -166,7 +166,7 @@ impl Resolve for GaiResolver {
}
impl fmt::Debug for GaiResolver {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.pad("GaiResolver")
}
}
@@ -184,7 +184,7 @@ impl Future for GaiFuture {
}
impl fmt::Debug for GaiFuture {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.pad("GaiFuture")
}
}
@@ -198,7 +198,7 @@ impl Iterator for GaiAddrs {
}
impl fmt::Debug for GaiAddrs {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.pad("GaiAddrs")
}
}

View File

@@ -198,7 +198,7 @@ impl<R> HttpConnector<R> {
// R: Debug required for now to allow adding it to debug output later...
impl<R: fmt::Debug> fmt::Debug for HttpConnector<R> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("HttpConnector")
.finish()
}
@@ -282,7 +282,7 @@ enum InvalidUrl {
}
impl fmt::Display for InvalidUrl {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.write_str(self.description())
}
}
@@ -382,7 +382,7 @@ where
}
impl<R: Resolve + fmt::Debug> fmt::Debug for HttpConnecting<R> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.pad("HttpConnecting")
}
}
@@ -615,8 +615,6 @@ mod tests {
#[test]
#[cfg_attr(not(feature = "__internal_happy_eyeballs_tests"), ignore)]
fn client_happy_eyeballs() {
extern crate pretty_env_logger;
use std::net::{IpAddr, Ipv4Addr, Ipv6Addr, TcpListener};
use std::time::{Duration, Instant};

View File

@@ -346,7 +346,7 @@ impl Clone for Extra {
}
impl fmt::Debug for Extra {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("Extra")
.finish()
}