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