Skip to content

Commit 3e7ca9c

Browse files
committed
chore: use 2018 edition idioms
1 parent 32b02cc commit 3e7ca9c

38 files changed

+90
-146
lines changed

examples/client.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
#![deny(warnings)]
2-
extern crate hyper;
3-
extern crate pretty_env_logger;
4-
2+
#![warn(rust_2018_idioms)]
53
use std::env;
64
use std::io::{self, Write};
75

examples/client_json.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
#![deny(warnings)]
2-
extern crate hyper;
2+
#![warn(rust_2018_idioms)]
3+
34
#[macro_use]
45
extern crate serde_derive;
5-
extern crate serde;
6-
extern crate serde_json;
76

87
use hyper::Client;
98
use futures_util::TryStreamExt;

examples/multi_server.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#![deny(warnings)]
2-
extern crate hyper;
3-
extern crate pretty_env_logger;
2+
#![warn(rust_2018_idioms)]
43

54
use hyper::{Body, Request, Response, Server};
65
use hyper::service::{service_fn, make_service_fn};

examples/params.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
// #![deny(warnings)] // FIXME: https://github.com/rust-lang/rust/issues/62411
2-
extern crate hyper;
3-
extern crate pretty_env_logger;
4-
extern crate url;
2+
#![warn(rust_2018_idioms)]
53

64
use hyper::{Body, Method, Request, Response, Server, StatusCode};
75
use hyper::service::{service_fn, make_service_fn};

src/body/body.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ use futures_core::{Stream, TryStream};
77
use futures_channel::{mpsc, oneshot};
88
use futures_util::TryStreamExt;
99
//use tokio_buf::SizeHint;
10-
use h2;
1110
use http::HeaderMap;
1211

1312
use crate::common::{Future, Never, Pin, Poll, task};
@@ -130,7 +129,6 @@ impl Body {
130129
///
131130
/// ```
132131
/// # use hyper::Body;
133-
/// # use futures_util;
134132
/// # fn main() {
135133
/// let chunks: Vec<Result<_, ::std::io::Error>> = vec![
136134
/// Ok("hello"),
@@ -346,7 +344,7 @@ impl Payload for Body {
346344
}
347345

348346
impl fmt::Debug for Body {
349-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
347+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
350348
#[derive(Debug)]
351349
struct Streaming;
352350
#[derive(Debug)]

src/body/chunk.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ impl AsRef<[u8]> for Chunk {
113113

114114
impl fmt::Debug for Chunk {
115115
#[inline]
116-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
116+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
117117
fmt::Debug::fmt(&self.bytes, f)
118118
}
119119
}

src/client/conn.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ use std::sync::Arc;
1414

1515
use bytes::Bytes;
1616
use futures_util::future::{self, Either, FutureExt as _};
17-
use h2;
1817
use tokio_io::{AsyncRead, AsyncWrite};
1918

2019
use crate::body::Payload;
@@ -258,7 +257,7 @@ impl<T, B> Service for SendRequest<T, B> {
258257
*/
259258

260259
impl<B> fmt::Debug for SendRequest<B> {
261-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
260+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
262261
f.debug_struct("SendRequest")
263262
.finish()
264263
}
@@ -305,7 +304,7 @@ where
305304
}
306305

307306
impl<B> fmt::Debug for Http2SendRequest<B> {
308-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
307+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
309308
f.debug_struct("Http2SendRequest")
310309
.finish()
311310
}
@@ -410,7 +409,7 @@ where
410409
T: AsyncRead + AsyncWrite + fmt::Debug + Send + 'static,
411410
B: Payload + 'static,
412411
{
413-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
412+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
414413
f.debug_struct("Connection")
415414
.finish()
416415
}
@@ -575,7 +574,7 @@ impl Future for ResponseFuture {
575574
}
576575

577576
impl fmt::Debug for ResponseFuture {
578-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
577+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
579578
f.debug_struct("ResponseFuture")
580579
.finish()
581580
}

src/client/connect/dns.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,13 +75,13 @@ impl Name {
7575
}
7676

7777
impl fmt::Debug for Name {
78-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
78+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
7979
fmt::Debug::fmt(&self.host, f)
8080
}
8181
}
8282

8383
impl fmt::Display for Name {
84-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
84+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
8585
fmt::Display::fmt(&self.host, f)
8686
}
8787
}
@@ -100,7 +100,7 @@ impl FromStr for Name {
100100
pub struct InvalidNameError(());
101101

102102
impl fmt::Display for InvalidNameError {
103-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
103+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
104104
f.write_str("Not a valid domain name")
105105
}
106106
}
@@ -166,7 +166,7 @@ impl Resolve for GaiResolver {
166166
}
167167

168168
impl fmt::Debug for GaiResolver {
169-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
169+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
170170
f.pad("GaiResolver")
171171
}
172172
}
@@ -184,7 +184,7 @@ impl Future for GaiFuture {
184184
}
185185

186186
impl fmt::Debug for GaiFuture {
187-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
187+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
188188
f.pad("GaiFuture")
189189
}
190190
}
@@ -198,7 +198,7 @@ impl Iterator for GaiAddrs {
198198
}
199199

200200
impl fmt::Debug for GaiAddrs {
201-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
201+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
202202
f.pad("GaiAddrs")
203203
}
204204
}

src/client/connect/http.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ impl<R> HttpConnector<R> {
198198

199199
// R: Debug required for now to allow adding it to debug output later...
200200
impl<R: fmt::Debug> fmt::Debug for HttpConnector<R> {
201-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
201+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
202202
f.debug_struct("HttpConnector")
203203
.finish()
204204
}
@@ -282,7 +282,7 @@ enum InvalidUrl {
282282
}
283283

284284
impl fmt::Display for InvalidUrl {
285-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
285+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
286286
f.write_str(self.description())
287287
}
288288
}
@@ -382,7 +382,7 @@ where
382382
}
383383

384384
impl<R: Resolve + fmt::Debug> fmt::Debug for HttpConnecting<R> {
385-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
385+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
386386
f.pad("HttpConnecting")
387387
}
388388
}
@@ -615,8 +615,6 @@ mod tests {
615615
#[test]
616616
#[cfg_attr(not(feature = "__internal_happy_eyeballs_tests"), ignore)]
617617
fn client_happy_eyeballs() {
618-
extern crate pretty_env_logger;
619-
620618
use std::net::{IpAddr, Ipv4Addr, Ipv6Addr, TcpListener};
621619
use std::time::{Duration, Instant};
622620

src/client/connect/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ impl Clone for Extra {
346346
}
347347

348348
impl fmt::Debug for Extra {
349-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
349+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
350350
f.debug_struct("Extra")
351351
.finish()
352352
}

0 commit comments

Comments
 (0)