Skip to content

Commit 2abf6ae

Browse files
djcctz
authored andcommitted
Fix formatting with cargo fmt
1 parent 3e30b11 commit 2abf6ae

File tree

5 files changed

+31
-12
lines changed

5 files changed

+31
-12
lines changed

.rustfmt.toml

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
chain_width=40

examples/server.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,10 @@ fn load_certs(filename: &str) -> io::Result<Vec<rustls::Certificate>> {
109109
// Load and return certificate.
110110
let certs = rustls_pemfile::certs(&mut reader)
111111
.map_err(|_| error("failed to load certificate".into()))?;
112-
Ok(certs.into_iter().map(rustls::Certificate).collect())
112+
Ok(certs
113+
.into_iter()
114+
.map(rustls::Certificate)
115+
.collect())
113116
}
114117

115118
// Load private key from file.

src/config.rs

+12-7
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,18 @@ impl ConfigBuilderExt for ConfigBuilder<ClientConfig, WantsVerifier> {
5454
#[cfg_attr(docsrs, doc(cfg(feature = "webpki-roots")))]
5555
fn with_webpki_roots(self) -> ConfigBuilder<ClientConfig, WantsTransparencyPolicyOrClientCert> {
5656
let mut roots = rustls::RootCertStore::empty();
57-
roots.add_server_trust_anchors(webpki_roots::TLS_SERVER_ROOTS.0.iter().map(|ta| {
58-
rustls::OwnedTrustAnchor::from_subject_spki_name_constraints(
59-
ta.subject,
60-
ta.spki,
61-
ta.name_constraints,
62-
)
63-
}));
57+
roots.add_server_trust_anchors(
58+
webpki_roots::TLS_SERVER_ROOTS
59+
.0
60+
.iter()
61+
.map(|ta| {
62+
rustls::OwnedTrustAnchor::from_subject_spki_name_constraints(
63+
ta.subject,
64+
ta.spki,
65+
ta.name_constraints,
66+
)
67+
}),
68+
);
6469
self.with_root_certificates(roots)
6570
}
6671
}

src/connector.rs

+10-3
Original file line numberDiff line numberDiff line change
@@ -74,18 +74,25 @@ where
7474
let connecting_future = self.http.call(dst);
7575

7676
let f = async move {
77-
let tcp = connecting_future.await.map_err(Into::into)?;
77+
let tcp = connecting_future
78+
.await
79+
.map_err(Into::into)?;
7880

7981
Ok(MaybeHttpsStream::Http(tcp))
8082
};
8183
Box::pin(f)
8284
} else if sch == &http::uri::Scheme::HTTPS {
8385
let cfg = self.tls_config.clone();
84-
let hostname = dst.host().unwrap_or_default().to_string();
86+
let hostname = dst
87+
.host()
88+
.unwrap_or_default()
89+
.to_string();
8590
let connecting_future = self.http.call(dst);
8691

8792
let f = async move {
88-
let tcp = connecting_future.await.map_err(Into::into)?;
93+
let tcp = connecting_future
94+
.await
95+
.map_err(Into::into)?;
8996
let connector = TlsConnector::from(cfg);
9097
let dnsname = rustls::ServerName::try_from(hostname.as_str())
9198
.map_err(|_| io::Error::new(io::ErrorKind::Other, "invalid dnsname"))?;

src/connector/builder.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,10 @@ mod tests {
284284
.https_only()
285285
.enable_http1()
286286
.build();
287-
assert!(connector.tls_config.alpn_protocols.is_empty());
287+
assert!(connector
288+
.tls_config
289+
.alpn_protocols
290+
.is_empty());
288291
let connector = HttpsConnectorBuilder::new()
289292
.with_tls_config(tls_config.clone())
290293
.https_only()

0 commit comments

Comments
 (0)