From 5d6d309e66b79d837ede20a26d654274bfb68d8f Mon Sep 17 00:00:00 2001 From: Juan Aguilar Date: Mon, 20 Jul 2020 14:09:24 +0000 Subject: [PATCH] Simplify bcodec decode (#162) --- actix-codec/CHANGES.md | 1 + actix-codec/src/bcodec.rs | 3 +-- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/actix-codec/CHANGES.md b/actix-codec/CHANGES.md index 4c318464..aa873992 100644 --- a/actix-codec/CHANGES.md +++ b/actix-codec/CHANGES.md @@ -4,6 +4,7 @@ * Use `.advance()` instead of `.split_to()`. * Upgrade `tokio-util` to `0.3`. * Improve `BytesCodec` `.encode()` performance +* Simplify `BytesCodec` `.decode()` ## [0.2.0] - 2019-12-10 diff --git a/actix-codec/src/bcodec.rs b/actix-codec/src/bcodec.rs index 6faceadd..e67edae1 100644 --- a/actix-codec/src/bcodec.rs +++ b/actix-codec/src/bcodec.rs @@ -27,8 +27,7 @@ impl Decoder for BytesCodec { if src.is_empty() { Ok(None) } else { - let len = src.len(); - Ok(Some(src.split_to(len))) + Ok(Some(src.split())) } } }