Clippy fixes (#118)
This commit is contained in:
parent
87ecfe7c01
commit
c033514814
2
.github/workflows/CI.yml
vendored
2
.github/workflows/CI.yml
vendored
@ -5,6 +5,8 @@ on:
|
||||
branches:
|
||||
- master
|
||||
pull_request: {}
|
||||
schedule:
|
||||
- cron: "33 4 * * 5"
|
||||
|
||||
jobs:
|
||||
check:
|
||||
|
@ -129,8 +129,6 @@ async fn stream_good() -> io::Result<()> {
|
||||
io::copy(&mut Cursor::new(FILE), &mut server.writer())?;
|
||||
server.send_close_notify();
|
||||
|
||||
let mut server = Connection::from(server);
|
||||
|
||||
{
|
||||
let mut good = Good(&mut server);
|
||||
let mut stream = Stream::new(&mut good, &mut client);
|
||||
|
@ -401,11 +401,11 @@ impl<T> TlsStream<T> {
|
||||
match self {
|
||||
Client(io) => {
|
||||
let (io, session) = io.get_ref();
|
||||
(io, &*session)
|
||||
(io, session)
|
||||
}
|
||||
Server(io) => {
|
||||
let (io, session) = io.get_ref();
|
||||
(io, &*session)
|
||||
(io, session)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -111,19 +111,16 @@ async fn pass() -> io::Result<()> {
|
||||
tokio::time::sleep(Duration::from_secs(1)).await;
|
||||
|
||||
let chain = certs(&mut std::io::Cursor::new(*chain)).unwrap();
|
||||
let trust_anchors = chain
|
||||
.iter()
|
||||
.map(|cert| {
|
||||
let ta = webpki::TrustAnchor::try_from_cert_der(&cert[..]).unwrap();
|
||||
OwnedTrustAnchor::from_subject_spki_name_constraints(
|
||||
ta.subject,
|
||||
ta.spki,
|
||||
ta.name_constraints,
|
||||
)
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
let mut root_store = rustls::RootCertStore::empty();
|
||||
root_store.add_server_trust_anchors(trust_anchors.into_iter());
|
||||
root_store.add_server_trust_anchors(chain.iter().map(|cert| {
|
||||
let ta = webpki::TrustAnchor::try_from_cert_der(&cert[..]).unwrap();
|
||||
OwnedTrustAnchor::from_subject_spki_name_constraints(
|
||||
ta.subject,
|
||||
ta.spki,
|
||||
ta.name_constraints,
|
||||
)
|
||||
}));
|
||||
|
||||
let config = rustls::ClientConfig::builder()
|
||||
.with_safe_defaults()
|
||||
.with_root_certificates(root_store)
|
||||
@ -140,19 +137,16 @@ async fn fail() -> io::Result<()> {
|
||||
let (addr, domain, chain) = start_server();
|
||||
|
||||
let chain = certs(&mut std::io::Cursor::new(*chain)).unwrap();
|
||||
let trust_anchors = chain
|
||||
.iter()
|
||||
.map(|cert| {
|
||||
let ta = webpki::TrustAnchor::try_from_cert_der(&cert[..]).unwrap();
|
||||
OwnedTrustAnchor::from_subject_spki_name_constraints(
|
||||
ta.subject,
|
||||
ta.spki,
|
||||
ta.name_constraints,
|
||||
)
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
let mut root_store = rustls::RootCertStore::empty();
|
||||
root_store.add_server_trust_anchors(trust_anchors.into_iter());
|
||||
root_store.add_server_trust_anchors(chain.iter().map(|cert| {
|
||||
let ta = webpki::TrustAnchor::try_from_cert_der(&cert[..]).unwrap();
|
||||
OwnedTrustAnchor::from_subject_spki_name_constraints(
|
||||
ta.subject,
|
||||
ta.spki,
|
||||
ta.name_constraints,
|
||||
)
|
||||
}));
|
||||
|
||||
let config = rustls::ClientConfig::builder()
|
||||
.with_safe_defaults()
|
||||
.with_root_certificates(root_store)
|
||||
@ -190,7 +184,7 @@ async fn test_lazy_config_acceptor() -> io::Result<()> {
|
||||
assert_eq!(
|
||||
ch.alpn()
|
||||
.map(|protos| protos.collect::<Vec<_>>())
|
||||
.unwrap_or(Vec::new()),
|
||||
.unwrap_or_default(),
|
||||
Vec::<&[u8]>::new()
|
||||
);
|
||||
|
||||
|
@ -27,18 +27,15 @@ mod utils {
|
||||
let mut client_root_cert_store = RootCertStore::empty();
|
||||
let mut chain = BufReader::new(Cursor::new(CHAIN));
|
||||
let certs = certs(&mut chain).unwrap();
|
||||
let trust_anchors = certs
|
||||
.iter()
|
||||
.map(|cert| {
|
||||
let ta = webpki::TrustAnchor::try_from_cert_der(&cert[..]).unwrap();
|
||||
OwnedTrustAnchor::from_subject_spki_name_constraints(
|
||||
ta.subject,
|
||||
ta.spki,
|
||||
ta.name_constraints,
|
||||
)
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
client_root_cert_store.add_server_trust_anchors(trust_anchors.into_iter());
|
||||
client_root_cert_store.add_server_trust_anchors(certs.iter().map(|cert| {
|
||||
let ta = webpki::TrustAnchor::try_from_cert_der(&cert[..]).unwrap();
|
||||
OwnedTrustAnchor::from_subject_spki_name_constraints(
|
||||
ta.subject,
|
||||
ta.spki,
|
||||
ta.name_constraints,
|
||||
)
|
||||
}));
|
||||
|
||||
let cconfig = ClientConfig::builder()
|
||||
.with_safe_defaults()
|
||||
.with_root_certificates(client_root_cert_store)
|
||||
|
Loading…
Reference in New Issue
Block a user