Skip to content

Commit cd03960

Browse files
authored
chore: further simplify BufList::copy_to_bytes
1 parent 42aff87 commit cd03960

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

src/common/buf.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,7 @@ impl<T: Buf> Buf for BufList<T> {
7575
// Our inner buffer may have an optimized version of copy_to_bytes, and if the whole
7676
// request can be fulfilled by the front buffer, we can take advantage.
7777
match self.bufs.front_mut() {
78-
Some(front) if front.remaining() == len => {
79-
let b = front.copy_to_bytes(len);
80-
self.bufs.pop_front();
81-
b
82-
}
78+
Some(front) if front.remaining() == len => self.bytes.pop_front().unwrap(),
8379
Some(front) if front.remaining() > len => front.copy_to_bytes(len),
8480
_ => {
8581
assert!(len <= self.remaining(), "`len` greater than remaining");

0 commit comments

Comments
 (0)