From ec906dcf1980e7c6e6d73f9e11048296b2ee05d9 Mon Sep 17 00:00:00 2001 From: Christian Ebner Date: Wed, 8 Jan 2020 10:46:56 +0100 Subject: [PATCH] src/pxar/encoder.rs: avoid use of macro and initialize Vec with known capacity. Signed-off-by: Christian Ebner --- src/pxar/encoder.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pxar/encoder.rs b/src/pxar/encoder.rs index 21c78f0a..f37eac72 100644 --- a/src/pxar/encoder.rs +++ b/src/pxar/encoder.rs @@ -630,7 +630,7 @@ impl<'a, W: Write, C: BackupCatalogWriter> Encoder<'a, W, C> { ) -> Result<(), Error> { //println!("encode_dir: {:?} start {}", self.full_path(), self.writer_pos); - let mut name_list = vec![]; + let mut name_list = Vec::new(); let rawfd = dir.as_raw_fd(); @@ -771,7 +771,7 @@ impl<'a, W: Write, C: BackupCatalogWriter> Encoder<'a, W, C> { name_list.sort_unstable_by(|a, b| a.0.cmp(&b.0)); - let mut goodbye_items = vec![]; + let mut goodbye_items = Vec::with_capacity(name_list.len()); for (filename, stat, exclude_list) in name_list { let start_pos = self.writer_pos;