1
Fork 0

Rollup merge of #97922 - paolobarbolini:no-vecdeque-extra-reserve, r=the8472

Remove redundant calls to reserve in impl Write for VecDeque

Removes the reserve calls made redundant by #95904 (as discussed in https://github.com/rust-lang/rust/pull/95632#discussion_r846850293)
This commit is contained in:
Yuki Okushi 2022-06-10 17:22:31 +09:00 committed by GitHub
commit 3e5ddb73a8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -441,14 +441,12 @@ impl<A: Allocator> Read for VecDeque<u8, A> {
impl<A: Allocator> Write for VecDeque<u8, A> {
#[inline]
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
self.reserve(buf.len());
self.extend(buf);
Ok(buf.len())
}
#[inline]
fn write_all(&mut self, buf: &[u8]) -> io::Result<()> {
self.reserve(buf.len());
self.extend(buf);
Ok(())
}