Skip to content

Commit 07f6fff

Browse files
committed
lint
1 parent 0fb0ba9 commit 07f6fff

File tree

1 file changed

+9
-15
lines changed
  • apollo-router/src/axum_factory/compression

1 file changed

+9
-15
lines changed

apollo-router/src/axum_factory/compression/mod.rs

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ pub(crate) mod util;
2222
pub(crate) enum Compressor {
2323
Deflate(DeflateEncoder),
2424
Gzip(GzipEncoder),
25-
Brotli(BrotliEncoder),
25+
Brotli(Box<BrotliEncoder>),
2626
Zstd(ZstdEncoder),
2727
}
2828

@@ -41,9 +41,9 @@ impl Compressor {
4141
}
4242
// FIXME: find the "fast" brotli encoder params
4343
"br" => {
44-
return Some(Compressor::Brotli(BrotliEncoder::new(
44+
return Some(Compressor::Brotli(Box::new(BrotliEncoder::new(
4545
BrotliEncoderParams::default(),
46-
)))
46+
))))
4747
}
4848
"zstd" => {
4949
return Some(Compressor::Zstd(ZstdEncoder::new(zstd_safe::min_c_level())))
@@ -74,7 +74,7 @@ where {
7474
while let Some(data) = stream.next().await {
7575
match data {
7676
Err(e) => {
77-
if let Err(_) = tx.send(Err(e.into())).await {
77+
if (tx.send(Err(e.into())).await).is_err() {
7878
return;
7979
}
8080
}
@@ -87,12 +87,9 @@ where {
8787
let mut partial_output = PartialBuffer::new(&mut buf);
8888
partial_output.advance(written);
8989

90-
match self.encode(&mut partial_input, &mut partial_output) {
91-
Err(e) => {
92-
let _ = tx.send(Err(e.into())).await;
93-
return;
94-
}
95-
Ok(()) => {}
90+
if let Err(e) = self.encode(&mut partial_input, &mut partial_output) {
91+
let _ = tx.send(Err(e.into())).await;
92+
return;
9693
}
9794

9895
written += partial_output.written().len();
@@ -114,7 +111,7 @@ where {
114111
let len = partial_output.written().len();
115112
let _ = partial_output.into_inner();
116113
buf.resize(len, 0);
117-
if let Err(_) = tx.send(Ok(buf.freeze())).await {
114+
if (tx.send(Ok(buf.freeze())).await).is_err() {
118115
return;
119116
}
120117
break;
@@ -132,16 +129,13 @@ where {
132129
match self.finish(&mut partial_output) {
133130
Err(e) => {
134131
let _ = tx.send(Err(e.into())).await;
135-
return;
136132
}
137133
Ok(_) => {
138134
let len = partial_output.written().len();
139135

140136
let mut buf = partial_output.into_inner();
141137
buf.resize(len, 0);
142-
if let Err(_) = tx.send(Ok(buf.freeze())).await {
143-
return;
144-
}
138+
let _ = tx.send(Ok(buf.freeze())).await;
145139
}
146140
}
147141
});

0 commit comments

Comments
 (0)