Refactor: don't search for src_data twice

This commit is contained in:
Chris Hennick 2023-04-29 13:19:55 -07:00
parent d5681d9ede
commit 9a47bbb6c8
No known key found for this signature in database
GPG key ID: 25653935CC8B6C74

View file

@ -320,7 +320,10 @@ impl<A: Read + Write + Seek> ZipWriter<A> {
compressed_size,
uncompressed_size,
};
let mut reader = BufReader::new(ZipFileReader::Raw(find_content(&data, self.inner.get_plain())?));
let mut reader = BufReader::new(ZipFileReader::Raw(find_content(
&src_data.to_owned(),
self.inner.get_plain(),
)?));
let mut copy = Vec::with_capacity(compressed_size as usize);
reader.read_to_end(&mut copy)?;
drop(reader);