catar/encoder.rs: code cleanup

Note: Rust Vec resize uses len(), not capacity()!
This commit is contained in:
Dietmar Maurer 2019-01-04 17:23:01 +01:00
parent df9973e8f5
commit 9409255aae

View File

@ -131,8 +131,8 @@ impl <'a, W: Write> CaTarEncoder<'a, W> {
self.write_header(CA_FORMAT_GOODBYE, goodbye_table_size as u64)?;
if self.file_copy_buffer.capacity() < goodbye_table_size {
let need = goodbye_table_size - self.file_copy_buffer.capacity();
if self.file_copy_buffer.len() < goodbye_table_size {
let need = goodbye_table_size - self.file_copy_buffer.len();
self.file_copy_buffer.reserve(need);
unsafe { self.file_copy_buffer.set_len(self.file_copy_buffer.capacity()); }
}