Skip to content

Commit

Permalink
fix clippy warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
picoHz committed Jul 2, 2023
1 parent ec2613d commit b53ec95
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 22 deletions.
2 changes: 1 addition & 1 deletion taxy/src/certs/mod.rs
Expand Up @@ -138,7 +138,7 @@ impl Cert {
) -> Result<Self, Error> {
let key = if let Some(pem_key) = &pem_key {
let key_pem =
std::str::from_utf8(&pem_key).map_err(|_| Error::FailedToDecryptPrivateKey)?;
std::str::from_utf8(pem_key).map_err(|_| Error::FailedToDecryptPrivateKey)?;
let (_, key) =
SecretDocument::from_pem(key_pem).map_err(|_| Error::FailedToDecryptPrivateKey)?;
Some(key)
Expand Down
30 changes: 15 additions & 15 deletions taxy/src/proxy/http/compression.rs
Expand Up @@ -93,20 +93,20 @@ mod test {
use super::*;
#[test]
fn test_is_compressed() {
assert_eq!(is_compressed(b"text/html"), false);
assert_eq!(is_compressed(b"application/json"), false);
assert_eq!(is_compressed(b"image/svg+xml"), false);
assert_eq!(is_compressed(b"image/bmp"), false);
assert_eq!(is_compressed(b"image/png"), true);
assert_eq!(is_compressed(b"image/x-ms-bmp"), false);
assert_eq!(is_compressed(b"audio/mp3"), true);
assert_eq!(is_compressed(b"audio/wav"), false);
assert_eq!(is_compressed(b"audio/x-wav"), false);
assert_eq!(is_compressed(b"audio/midi"), false);
assert_eq!(is_compressed(b"audio/x-midi"), false);
assert_eq!(is_compressed(b"video/webm"), true);
assert_eq!(is_compressed(b"application/x-bzip"), true);
assert_eq!(is_compressed(b"application/x-bzip2"), true);
assert_eq!(is_compressed(b"application/gzip"), true);
assert!(!is_compressed(b"text/html"));
assert!(!is_compressed(b"application/json"));
assert!(!is_compressed(b"image/svg+xml"));
assert!(!is_compressed(b"image/bmp"));
assert!(is_compressed(b"image/png"));
assert!(!is_compressed(b"image/x-ms-bmp"));
assert!(is_compressed(b"audio/mp3"));
assert!(!is_compressed(b"audio/wav"));
assert!(!is_compressed(b"audio/x-wav"));
assert!(!is_compressed(b"audio/midi"));
assert!(!is_compressed(b"audio/x-midi"));
assert!(is_compressed(b"video/webm"));
assert!(is_compressed(b"application/x-bzip"));
assert!(is_compressed(b"application/x-bzip2"));
assert!(is_compressed(b"application/gzip"));
}
}
2 changes: 1 addition & 1 deletion taxy/tests/http_test.rs
Expand Up @@ -12,7 +12,7 @@ use common::{with_server, TestStorage};
#[tokio::test]
async fn http_proxy() -> anyhow::Result<()> {
let listener = TcpListener::bind("127.0.0.1:52000").await.unwrap();
let hello = warp::path!("hello").map(|| format!("Hello"));
let hello = warp::path!("hello").map(|| "Hello".to_string());
tokio::spawn(warp::serve(hello).run_incoming(TcpListenerStream::new(listener)));

let config = TestStorage::builder()
Expand Down
4 changes: 2 additions & 2 deletions taxy/tests/https_test.rs
Expand Up @@ -16,11 +16,11 @@ async fn https_proxy() -> anyhow::Result<()> {
let cert = Arc::new(Cert::new_self_signed(&["localhost".parse().unwrap()], &root).unwrap());

let addr = "localhost:53000".to_socket_addrs().unwrap().next().unwrap();
let hello = warp::path!("hello").map(|| format!("Hello"));
let hello = warp::path!("hello").map(|| "Hello".to_string());
let (_, server) = warp::serve(hello)
.tls()
.cert(&cert.pem_chain)
.key(&cert.pem_key.as_ref().unwrap())
.key(cert.pem_key.as_ref().unwrap())
.bind_ephemeral(addr);
tokio::spawn(server);

Expand Down
2 changes: 1 addition & 1 deletion taxy/tests/tcp_test.rs
Expand Up @@ -9,7 +9,7 @@ use common::{with_server, TestStorage};
#[tokio::test]
async fn tcp_proxy() -> anyhow::Result<()> {
let listener = TcpListener::bind("127.0.0.1:50000").await.unwrap();
let hello = warp::path!("hello").map(|| format!("Hello"));
let hello = warp::path!("hello").map(|| "Hello".to_string());
tokio::spawn(warp::serve(hello).run_incoming(TcpListenerStream::new(listener)));

let config = TestStorage::builder()
Expand Down
4 changes: 2 additions & 2 deletions taxy/tests/tls_test.rs
Expand Up @@ -15,11 +15,11 @@ async fn tls_proxy() -> anyhow::Result<()> {
let cert = Arc::new(Cert::new_self_signed(&["localhost".parse().unwrap()], &root).unwrap());

let addr = "localhost:51000".to_socket_addrs().unwrap().next().unwrap();
let hello = warp::path!("hello").map(|| format!("Hello"));
let hello = warp::path!("hello").map(|| "Hello".to_string());
let (_, server) = warp::serve(hello)
.tls()
.cert(&cert.pem_chain)
.key(&cert.pem_key.as_ref().unwrap())
.key(cert.pem_key.as_ref().unwrap())
.bind_ephemeral(addr);
tokio::spawn(server);

Expand Down

0 comments on commit b53ec95

Please sign in to comment.