chore: apply clippy suggestions from 1.65 (#122)

pull/1/head
Dirkjan Ochtman 2 years ago committed by GitHub
parent 24473eaff9
commit 9d58c7d29e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      tokio-rustls/src/lib.rs
  2. 29
      tokio-rustls/tests/early-data.rs
  3. 2
      tokio-rustls/tests/test.rs

@ -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
/// 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)]
pub enum TlsStream<T> {
Client(client::TlsStream<T>),

@ -75,7 +75,7 @@ async fn send(
match read_task.await {
Ok(()) => (),
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<_>
@ -106,9 +106,9 @@ async fn test_0rtt() -> io::Result<()> {
.arg("s_server")
.arg("-early_data")
.arg("-tls1_3")
.args(&["-cert", "./tests/end.cert"])
.args(&["-key", "./tests/end.rsa"])
.args(&["-port", "12354"])
.args(["-cert", "./tests/end.cert"])
.args(["-key", "./tests/end.rsa"])
.args(["-port", "12354"])
.stdin(Stdio::piped())
.stdout(Stdio::piped())
.spawn()
@ -119,19 +119,16 @@ async fn test_0rtt() -> io::Result<()> {
let mut chain = BufReader::new(Cursor::new(include_str!("end.chain")));
let certs = rustls_pemfile::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<_>>();
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,
)
});
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()
.with_safe_default_cipher_suites()
.with_safe_default_kx_groups()

@ -79,7 +79,7 @@ lazy_static! {
}
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<()> {

Loading…
Cancel
Save