From 3581559b5d9603085e5c2211c7d648aa044ee50c Mon Sep 17 00:00:00 2001 From: tottoto Date: Fri, 13 Dec 2024 21:54:23 +0900 Subject: [PATCH] chore: Remove redundant temporary variable (#2095) --- tonic/src/server/grpc.rs | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/tonic/src/server/grpc.rs b/tonic/src/server/grpc.rs index 09278ca78..81a048222 100644 --- a/tonic/src/server/grpc.rs +++ b/tonic/src/server/grpc.rs @@ -183,40 +183,36 @@ where #[doc(hidden)] pub fn apply_compression_config( - self, + mut self, accept_encodings: EnabledCompressionEncodings, send_encodings: EnabledCompressionEncodings, ) -> Self { - let mut this = self; - for &encoding in CompressionEncoding::ENCODINGS { if accept_encodings.is_enabled(encoding) { - this = this.accept_compressed(encoding); + self = self.accept_compressed(encoding); } if send_encodings.is_enabled(encoding) { - this = this.send_compressed(encoding); + self = self.send_compressed(encoding); } } - this + self } #[doc(hidden)] pub fn apply_max_message_size_config( - self, + mut self, max_decoding_message_size: Option, max_encoding_message_size: Option, ) -> Self { - let mut this = self; - if let Some(limit) = max_decoding_message_size { - this = this.max_decoding_message_size(limit); + self = self.max_decoding_message_size(limit); } if let Some(limit) = max_encoding_message_size { - this = this.max_encoding_message_size(limit); + self = self.max_encoding_message_size(limit); } - this + self } /// Handle a single unary gRPC request.