Win from avoiding some allocation

This commit is contained in:
Tony Garnock-Jones 2022-07-13 14:01:20 +02:00
parent 17707b8421
commit 18b9cb5df4
1 changed files with 1 additions and 1 deletions

View File

@ -36,7 +36,7 @@ impl IOList {
pub fn write_all(&mut self, cow: Cow<'_, [u8]>) {
self.len += cow.len();
match cow {
Cow::Borrowed(bs) => self.chunks.push(bs.to_owned()),
Cow::Borrowed(bs) => self.rightmost_chunk().extend_from_slice(bs),
Cow::Owned(bs) => self.chunks.push(bs),
}
}