From 0054e6610dec30ee1877b9125ff41ea69da9b033 Mon Sep 17 00:00:00 2001 From: Arthur LE MOIGNE Date: Thu, 3 Jun 2021 09:44:21 +0200 Subject: [PATCH] Prefer panic when 'ZstdDecoder::new' return 'Err' This is not a real possible case looking at zstd 0.7 --- actix-http/src/encoding/decoder.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/actix-http/src/encoding/decoder.rs b/actix-http/src/encoding/decoder.rs index 604ad2f4f..b8a503c7b 100644 --- a/actix-http/src/encoding/decoder.rs +++ b/actix-http/src/encoding/decoder.rs @@ -46,10 +46,9 @@ where ContentEncoding::Gzip => Some(ContentDecoder::Gzip(Box::new( GzDecoder::new(Writer::new()), ))), - ContentEncoding::Zstd => match ZstdDecoder::new(Writer::new()) { - Ok(decoder) => Some(ContentDecoder::Zstd(Box::new(decoder))), - Err(_) => None, - }, + ContentEncoding::Zstd => Some(ContentDecoder::Zstd(Box::new( + ZstdDecoder::new(Writer::new()).expect("Fail to create zstd decoder"), + ))), _ => None, };