From cdabda69a7f6d66e0e14c412d4d6d313fef4404a Mon Sep 17 00:00:00 2001 From: Emil Sauer Lynge Date: Thu, 13 Jan 2022 16:09:30 +0100 Subject: [PATCH] make linter happy --- src/lib.rs | 6 ++---- src/transport/quic.rs | 16 +++++----------- tests/integration_test.rs | 2 +- 3 files changed, 8 insertions(+), 16 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index a9079fbb..19391dc2 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -14,8 +14,6 @@ use config_watcher::ServiceChange; pub use constants::UDP_BUFFER_SIZE; use anyhow::Result; -use clap::arg; -use tokio::join; use tokio::sync::{broadcast, mpsc}; use tracing::{debug, info}; @@ -113,8 +111,8 @@ pub async fn run(args: Cli, shutdown_rx: broadcast::Receiver) -> Result<() } let _ = shutdown_tx.send(true); - if let Some((h,sender)) = last_instance{ - h.await; + if let Some((h,_)) = last_instance{ + h.await?; } Ok(()) } diff --git a/src/transport/quic.rs b/src/transport/quic.rs index fb31eabc..1afb853e 100644 --- a/src/transport/quic.rs +++ b/src/transport/quic.rs @@ -1,10 +1,7 @@ -use std::borrow::{Borrow, BorrowMut}; +use std::borrow::{BorrowMut}; use std::fmt::{Debug, Formatter}; -use std::io; use std::io::{Error, IoSlice}; use std::net::SocketAddr; -use std::ops::Deref; -use std::ops::DerefMut; use std::pin::Pin; use std::sync::Arc; use std::task::Poll; @@ -16,16 +13,13 @@ use anyhow::{anyhow, Context, Result}; use async_trait::async_trait; use futures_util::{StreamExt}; use openssl::pkcs12::Pkcs12; -use quinn::{Connecting, Connection, Endpoint, EndpointConfig, Incoming, NewConnection}; -use rustls::internal::msgs::codec::Codec; -use rustls::ClientConfig; +use quinn::{Connecting, Connection, Endpoint, EndpointConfig, Incoming}; use tokio::fs; -use tokio::io::{AsyncRead, AsyncWrite, ReadBuf}; +use tokio::io::{AsyncWrite, ReadBuf}; use tokio::net::{ToSocketAddrs, UdpSocket}; use tokio_native_tls::native_tls::Certificate; pub const ALPN_QUIC_TUNNEL: &[&[u8]] = &[b"qt"]; -pub const NONE: &str = "None"; pub struct QuicTransport { config: TlsConfig, @@ -51,7 +45,7 @@ pub struct QuicBiStream { } impl QuicBiStream { - fn new((mut send, recv): (quinn::SendStream, quinn::RecvStream), conn: Connection) -> Self { + fn new((send, recv): (quinn::SendStream, quinn::RecvStream), conn: Connection) -> Self { Self { send, recv, conn} } } @@ -143,7 +137,7 @@ impl Transport for QuicTransport { roots.add(&rustls::Certificate( cert.to_der() .with_context(|| "could not encode trust root as DER")?, - )); + )).with_context(|| "adding trusted root cert to trust store")?; let mut client_crypto = rustls::ClientConfig::builder() .with_safe_defaults() diff --git a/tests/integration_test.rs b/tests/integration_test.rs index fcf2cf67..9be27843 100644 --- a/tests/integration_test.rs +++ b/tests/integration_test.rs @@ -148,7 +148,7 @@ async fn test(config_path: &'static str, t: Type) -> Result<()> { // Simulate the server crash and restart info!("shutdown the server"); server_shutdown_tx.send(true)?; - let j = tokio::join!(server); + let _ = tokio::join!(server); info!("restart the server"); let server_shutdown_rx = server_shutdown_tx.subscribe();