chore: apply clippy suggestions from 1.65 (#122)

This commit is contained in:
Dirkjan Ochtman 2022-11-04 22:11:05 +01:00 committed by GitHub
parent 24473eaff9
commit 9d58c7d29e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 17 deletions

View File

@ -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>),

View File

@ -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() 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<_>>();
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()

View File

@ -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<()> {