From 49ead0f99e7f43a6ee7febee87c6243f8a3efbbb Mon Sep 17 00:00:00 2001 From: Jonas Platte Date: Sat, 27 Jan 2024 16:39:55 +0100 Subject: [PATCH] Simplify impl SupportedEncodings for AcceptEncoding --- tower-http/src/compression_utils.rs | 36 ++++++++++------------------- 1 file changed, 12 insertions(+), 24 deletions(-) diff --git a/tower-http/src/compression_utils.rs b/tower-http/src/compression_utils.rs index 1c8dd063..01aabc05 100644 --- a/tower-http/src/compression_utils.rs +++ b/tower-http/src/compression_utils.rs @@ -71,49 +71,37 @@ impl SupportedEncodings for AcceptEncoding { #[allow(dead_code)] fn gzip(&self) -> bool { #[cfg(any(feature = "decompression-gzip", feature = "compression-gzip"))] - { - self.gzip - } + return self.gzip; + #[cfg(not(any(feature = "decompression-gzip", feature = "compression-gzip")))] - { - false - } + return false; } #[allow(dead_code)] fn deflate(&self) -> bool { #[cfg(any(feature = "decompression-deflate", feature = "compression-deflate"))] - { - self.deflate - } + return self.deflate; + #[cfg(not(any(feature = "decompression-deflate", feature = "compression-deflate")))] - { - false - } + return false; } #[allow(dead_code)] fn br(&self) -> bool { #[cfg(any(feature = "decompression-br", feature = "compression-br"))] - { - self.br - } + return self.br; + #[cfg(not(any(feature = "decompression-br", feature = "compression-br")))] - { - false - } + return false; } #[allow(dead_code)] fn zstd(&self) -> bool { #[cfg(any(feature = "decompression-zstd", feature = "compression-zstd"))] - { - self.zstd - } + return self.zstd; + #[cfg(not(any(feature = "decompression-zstd", feature = "compression-zstd")))] - { - false - } + return false; } }