diff --git a/crates/tarball/src/lib.rs b/crates/tarball/src/lib.rs index 66e51e50..86deb560 100644 --- a/crates/tarball/src/lib.rs +++ b/crates/tarball/src/lib.rs @@ -211,12 +211,13 @@ impl<'a> DownloadTarballToStore<'a> { .pipe(Cursor::new) .pipe(Archive::new); - let entries = archive + let entries: Vec<_> = archive .entries() .map_err(TarballError::ReadTarballEntries)? - .filter(|entry| !entry.as_ref().unwrap().header().entry_type().is_dir()); + .filter(|entry| !entry.as_ref().unwrap().header().entry_type().is_dir()) + .collect(); - let ((_, Some(capacity)) | (capacity, None)) = entries.size_hint(); + let capacity = entries.len(); let mut cas_paths = HashMap::::with_capacity(capacity); let mut pkg_files_idx = PackageFilesIndex { files: HashMap::with_capacity(capacity) };