Prefer panic when 'ZstdDecoder::new' return 'Err'

This is not a real possible case looking at zstd 0.7
This commit is contained in:
Arthur LE MOIGNE 2021-06-03 09:44:21 +02:00
parent 478c96e01f
commit 0054e6610d
No known key found for this signature in database
GPG Key ID: 25D15180A1D2E077
1 changed files with 3 additions and 4 deletions

View File

@ -46,10 +46,9 @@ where
ContentEncoding::Gzip => Some(ContentDecoder::Gzip(Box::new( ContentEncoding::Gzip => Some(ContentDecoder::Gzip(Box::new(
GzDecoder::new(Writer::new()), GzDecoder::new(Writer::new()),
))), ))),
ContentEncoding::Zstd => match ZstdDecoder::new(Writer::new()) { ContentEncoding::Zstd => Some(ContentDecoder::Zstd(Box::new(
Ok(decoder) => Some(ContentDecoder::Zstd(Box::new(decoder))), ZstdDecoder::new(Writer::new()).expect("Fail to create zstd decoder"),
Err(_) => None, ))),
},
_ => None, _ => None,
}; };