reduce branch in actix_http::h1::codec

This commit is contained in:
fakeshadow 2020-12-27 03:40:49 +08:00
parent ecf08d5156
commit eba7c1e171
1 changed files with 2 additions and 2 deletions

View File

@ -111,8 +111,8 @@ impl Decoder for Codec {
type Error = ParseError;
fn decode(&mut self, src: &mut BytesMut) -> Result<Option<Self::Item>, Self::Error> {
if self.payload.is_some() {
Ok(match self.payload.as_mut().unwrap().decode(src)? {
if let Some(ref mut payload) = self.payload {
Ok(match payload.decode(src)? {
Some(PayloadItem::Chunk(chunk)) => Some(Message::Chunk(Some(chunk))),
Some(PayloadItem::Eof) => {
self.payload.take();