Skip to content

Commit 8b2e758

Browse files
committed
Reformat code
Formatted with 0.3.4-nightly.
1 parent 40669d1 commit 8b2e758

File tree

2 files changed

+29
-30
lines changed

2 files changed

+29
-30
lines changed

src/connector.rs

+28-29
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,14 @@ impl HttpsConnector {
2727
let mut http = HttpConnector::new(threads, handle);
2828
http.enforce_http(false);
2929
let mut config = ClientConfig::new();
30-
config.root_store.add_server_trust_anchors(&webpki_roots::TLS_SERVER_ROOTS);
30+
config
31+
.root_store
32+
.add_server_trust_anchors(&webpki_roots::TLS_SERVER_ROOTS);
3133
config.ct_logs = Some(&ct_logs::LOGS);
32-
HttpsConnector { http: http, tls_config: Arc::new(config) }
34+
HttpsConnector {
35+
http: http,
36+
tls_config: Arc::new(config),
37+
}
3338
}
3439
}
3540

@@ -59,45 +64,39 @@ impl Service for HttpsConnector {
5964
let host: DNSName = match uri.host() {
6065
Some(host) => match DNSNameRef::try_from_ascii_str(host) {
6166
Ok(host) => host.into(),
62-
Err(err) => return HttpsConnecting(
63-
Box::new(
64-
::futures::future::err(
65-
io::Error::new(
66-
io::ErrorKind::InvalidInput,
67-
format!("invalid url: {:?}", err),
68-
)
69-
)
70-
)
71-
),
67+
Err(err) => {
68+
return HttpsConnecting(Box::new(::futures::future::err(io::Error::new(
69+
io::ErrorKind::InvalidInput,
70+
format!("invalid url: {:?}", err),
71+
))))
72+
}
7273
},
73-
None => return HttpsConnecting(
74-
Box::new(
75-
::futures::future::err(
76-
io::Error::new(
77-
io::ErrorKind::InvalidInput,
78-
"invalid url, missing host"
79-
)
80-
)
81-
)
82-
),
74+
None => {
75+
return HttpsConnecting(Box::new(::futures::future::err(io::Error::new(
76+
io::ErrorKind::InvalidInput,
77+
"invalid url, missing host",
78+
))))
79+
}
8380
};
8481
let connecting = self.http.call(uri);
8582

8683
HttpsConnecting(if is_https {
8784
let tls = self.tls_config.clone();
88-
Box::new(connecting.and_then(move |tcp| {
89-
tls
90-
.connect_async(host.as_ref(), tcp)
91-
.map_err(|e| io::Error::new(io::ErrorKind::Other, e))
92-
}).map(|tls| MaybeHttpsStream::Https(tls))
93-
.map_err(|e| io::Error::new(io::ErrorKind::Other, e)))
85+
Box::new(
86+
connecting
87+
.and_then(move |tcp| {
88+
tls.connect_async(host.as_ref(), tcp)
89+
.map_err(|e| io::Error::new(io::ErrorKind::Other, e))
90+
})
91+
.map(|tls| MaybeHttpsStream::Https(tls))
92+
.map_err(|e| io::Error::new(io::ErrorKind::Other, e)),
93+
)
9494
} else {
9595
Box::new(connecting.map(|tcp| MaybeHttpsStream::Http(tcp)))
9696
})
9797
}
9898
}
9999

100-
101100
pub struct HttpsConnecting(Box<Future<Item = MaybeHttpsStream, Error = io::Error>>);
102101

103102
impl Future for HttpsConnecting {

src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
//! }
2626
//! ```
2727
28+
extern crate ct_logs;
2829
extern crate futures;
2930
extern crate hyper;
3031
extern crate rustls;
@@ -34,7 +35,6 @@ extern crate tokio_rustls;
3435
extern crate tokio_service;
3536
extern crate webpki;
3637
extern crate webpki_roots;
37-
extern crate ct_logs;
3838

3939
mod connector;
4040
mod stream;

0 commit comments

Comments
 (0)