From f04c8e8e2cf07d785f407aa5c15ab992caea8348 Mon Sep 17 00:00:00 2001 From: Pascal Hartig Date: Thu, 18 Mar 2021 05:10:34 -0700 Subject: [PATCH] Small optimisations Summary: We're passing around PathBufs where Paths are enough and more efficient. Reviewed By: fabiomassimo Differential Revision: D27155300 fbshipit-source-id: cdf8d67e28a669130482d333c960d100bdaf0992 --- packer/src/main.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/packer/src/main.rs b/packer/src/main.rs index a051d08d8..3d036bc34 100644 --- a/packer/src/main.rs +++ b/packer/src/main.rs @@ -56,9 +56,9 @@ fn default_progress_bar(len: u64) -> indicatif::ProgressBar { fn pack( platform: Platform, - dist_dir: &std::path::PathBuf, + dist_dir: &std::path::Path, pack_list: &PackList, - output_directory: &std::path::PathBuf, + output_directory: &std::path::Path, ) -> Result> { let pb = default_progress_bar(pack_list.0.len() as u64 * 2 - 1); pb.set_prefix(&format!( @@ -96,10 +96,10 @@ fn pack( res } -fn pack_platform( +fn pack_platform>( platform: Platform, - dist_dir: &std::path::PathBuf, - pack_files: &[path::PathBuf], + dist_dir: &std::path::Path, + pack_files: &[P], pack_type: PackType, tar_builder: &mut tar::Builder, ) -> Result<()> { @@ -240,14 +240,14 @@ fn compress_paths( fn manifest( archive_paths: &[(PackType, path::PathBuf)], compressed_archive_paths: &Option>, - output_directory: &path::PathBuf, + output_directory: &path::Path, ) -> Result { let archive_manifest = gen_manifest(archive_paths, compressed_archive_paths)?; write_manifest(output_directory, &archive_manifest) } fn write_manifest( - output_directory: &path::PathBuf, + output_directory: &path::Path, archive_manifest: &PackManifest, ) -> Result { let path = path::PathBuf::from(output_directory).join("manifest.json");