From 9a47bbb6c8efed22ea7c95cdb6d7752e7f87c034 Mon Sep 17 00:00:00 2001 From: Chris Hennick Date: Sat, 29 Apr 2023 13:19:55 -0700 Subject: [PATCH] Refactor: don't search for src_data twice --- src/write.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/write.rs b/src/write.rs index 89c73f70..e420e050 100644 --- a/src/write.rs +++ b/src/write.rs @@ -320,7 +320,10 @@ impl ZipWriter { 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);