chore: apply clippy suggestions from 1.65 (#122)
This commit is contained in:
parent
24473eaff9
commit
9d58c7d29e
@ -389,6 +389,7 @@ impl<IO: AsyncRead + AsyncWrite + Unpin> Future for FallibleAccept<IO> {
|
|||||||
///
|
///
|
||||||
/// This abstracts over the inner `client::TlsStream` and `server::TlsStream`, so you can use
|
/// This abstracts over the inner `client::TlsStream` and `server::TlsStream`, so you can use
|
||||||
/// a single type to keep both client- and server-initiated TLS-encrypted connections.
|
/// a single type to keep both client- and server-initiated TLS-encrypted connections.
|
||||||
|
#[allow(clippy::large_enum_variant)] // https://github.com/rust-lang/rust-clippy/issues/9798
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub enum TlsStream<T> {
|
pub enum TlsStream<T> {
|
||||||
Client(client::TlsStream<T>),
|
Client(client::TlsStream<T>),
|
||||||
|
@ -75,7 +75,7 @@ async fn send(
|
|||||||
match read_task.await {
|
match read_task.await {
|
||||||
Ok(()) => (),
|
Ok(()) => (),
|
||||||
Err(ref err) if err.kind() == io::ErrorKind::UnexpectedEof => (),
|
Err(ref err) if err.kind() == io::ErrorKind::UnexpectedEof => (),
|
||||||
Err(err) => return Err(err.into()),
|
Err(err) => return Err(err),
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(rd) as io::Result<_>
|
Ok(rd) as io::Result<_>
|
||||||
@ -106,9 +106,9 @@ async fn test_0rtt() -> io::Result<()> {
|
|||||||
.arg("s_server")
|
.arg("s_server")
|
||||||
.arg("-early_data")
|
.arg("-early_data")
|
||||||
.arg("-tls1_3")
|
.arg("-tls1_3")
|
||||||
.args(&["-cert", "./tests/end.cert"])
|
.args(["-cert", "./tests/end.cert"])
|
||||||
.args(&["-key", "./tests/end.rsa"])
|
.args(["-key", "./tests/end.rsa"])
|
||||||
.args(&["-port", "12354"])
|
.args(["-port", "12354"])
|
||||||
.stdin(Stdio::piped())
|
.stdin(Stdio::piped())
|
||||||
.stdout(Stdio::piped())
|
.stdout(Stdio::piped())
|
||||||
.spawn()
|
.spawn()
|
||||||
@ -119,19 +119,16 @@ async fn test_0rtt() -> io::Result<()> {
|
|||||||
|
|
||||||
let mut chain = BufReader::new(Cursor::new(include_str!("end.chain")));
|
let mut chain = BufReader::new(Cursor::new(include_str!("end.chain")));
|
||||||
let certs = rustls_pemfile::certs(&mut chain).unwrap();
|
let certs = rustls_pemfile::certs(&mut chain).unwrap();
|
||||||
let trust_anchors = certs
|
let trust_anchors = certs.iter().map(|cert| {
|
||||||
.iter()
|
|
||||||
.map(|cert| {
|
|
||||||
let ta = webpki::TrustAnchor::try_from_cert_der(&cert[..]).unwrap();
|
let ta = webpki::TrustAnchor::try_from_cert_der(&cert[..]).unwrap();
|
||||||
OwnedTrustAnchor::from_subject_spki_name_constraints(
|
OwnedTrustAnchor::from_subject_spki_name_constraints(
|
||||||
ta.subject,
|
ta.subject,
|
||||||
ta.spki,
|
ta.spki,
|
||||||
ta.name_constraints,
|
ta.name_constraints,
|
||||||
)
|
)
|
||||||
})
|
});
|
||||||
.collect::<Vec<_>>();
|
|
||||||
let mut root_store = RootCertStore::empty();
|
let mut root_store = RootCertStore::empty();
|
||||||
root_store.add_server_trust_anchors(trust_anchors.into_iter());
|
root_store.add_server_trust_anchors(trust_anchors);
|
||||||
let mut config = rustls::ClientConfig::builder()
|
let mut config = rustls::ClientConfig::builder()
|
||||||
.with_safe_default_cipher_suites()
|
.with_safe_default_cipher_suites()
|
||||||
.with_safe_default_kx_groups()
|
.with_safe_default_kx_groups()
|
||||||
|
@ -79,7 +79,7 @@ lazy_static! {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn start_server() -> &'static (SocketAddr, &'static str, &'static [u8]) {
|
fn start_server() -> &'static (SocketAddr, &'static str, &'static [u8]) {
|
||||||
&*TEST_SERVER
|
&TEST_SERVER
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn start_client(addr: SocketAddr, domain: &str, config: Arc<ClientConfig>) -> io::Result<()> {
|
async fn start_client(addr: SocketAddr, domain: &str, config: Arc<ClientConfig>) -> io::Result<()> {
|
||||||
|
Loading…
Reference in New Issue
Block a user