aboutsummaryrefslogtreecommitdiff
path: root/src/https.rs
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2021-12-09 23:38:56 +0100
committerAlex Auvolat <alex@adnab.me>2021-12-09 23:38:56 +0100
commitf7a5b29b719778974a6791d03b8c5eb2e5836355 (patch)
treea887ec309c49426676f6fd805f61a68e586fa1c2 /src/https.rs
parente0912dc5fe61839522db118a2dd2e06bb3c18d40 (diff)
downloadtricot-f7a5b29b719778974a6791d03b8c5eb2e5836355.tar.gz
tricot-f7a5b29b719778974a6791d03b8c5eb2e5836355.zip
cargo clippy
Diffstat (limited to 'src/https.rs')
-rw-r--r--src/https.rs10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/https.rs b/src/https.rs
index 1f603b9..f7562ff 100644
--- a/src/https.rs
+++ b/src/https.rs
@@ -116,7 +116,7 @@ async fn handle(
.to_str()?
};
let path = req.uri().path();
- let accept_encoding = accept_encoding_fork::encodings(req.headers()).unwrap_or(vec![]);
+ let accept_encoding = accept_encoding_fork::encodings(req.headers()).unwrap_or_else(|_| vec![]);
let best_match = proxy_config
.entries
@@ -194,6 +194,7 @@ async fn try_compress(
Encoding::Deflate,
Encoding::Gzip,
];
+ #[allow(clippy::float_cmp)]
let encoding_opt = accept_encoding
.iter()
.filter(|(_, q)| *q == max_q)
@@ -250,13 +251,16 @@ async fn try_compress(
}
// put beginning chunks back into body
- let body = futures::stream::iter(chunks.into_iter().map(|c| Ok(c))).chain(body);
+ let body = futures::stream::iter(chunks.into_iter().map(Ok)).chain(body);
// make an async reader from that for compressor
let body_rd =
StreamReader::new(body.map_err(|e| std::io::Error::new(std::io::ErrorKind::Other, e)));
- debug!("Compressing response body as {:?} (at least {} bytes)", encoding, sum_lengths);
+ debug!(
+ "Compressing response body as {:?} (at least {} bytes)",
+ encoding, sum_lengths
+ );
head.headers.remove(header::CONTENT_LENGTH);
let compressed_body = match encoding {