From 250d2e231c65d1a2089d9856fd37b91465a0b5f5 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jo=C3=A3o=20M=2E=20Bezerra?= Date: Tue, 7 Dec 2021 23:25:21 -0300 Subject: [PATCH] Reformat code --- src/commands.rs | 22 ++++++++++++++-------- src/utils/mod.rs | 19 +++++-------------- 2 files changed, 19 insertions(+), 22 deletions(-) diff --git a/src/commands.rs b/src/commands.rs index a4c5bd4..20a4f45 100644 --- a/src/commands.rs +++ b/src/commands.rs @@ -285,7 +285,7 @@ fn compress_files( formats: Vec, output_file: fs::File, output_dir: &Path, - question_policy: QuestionPolicy + question_policy: QuestionPolicy, ) -> crate::Result<()> { // The next lines are for displaying the progress bar // If the input files contain a directory, then the total size will be underestimated @@ -354,9 +354,11 @@ fn compress_files( } Zip => { eprintln!("{orange}[WARNING]{reset}", orange = *colors::ORANGE, reset = *colors::RESET); - eprintln!("\tThere is a limitation for .zip archives with extra extensions. (e.g. .zip.gz)\ + eprintln!( + "\tThere is a limitation for .zip archives with extra extensions. (e.g. .zip.gz)\ \n\tThe design of .zip makes it impossible to compress via stream, so it must be done entirely in memory.\ - \n\tBy compressing .zip with extra compression formats, you can run out of RAM if the file is too large!"); + \n\tBy compressing .zip with extra compression formats, you can run out of RAM if the file is too large!" + ); // give user the option to continue compressing after warning is shown if !user_wants_to_continue_compressing(output_dir, question_policy)? { @@ -513,9 +515,11 @@ fn decompress_file( } Zip => { eprintln!("{orange}[WARNING]{reset}", orange = *colors::ORANGE, reset = *colors::RESET); - eprintln!("\tThere is a limitation for .zip archives with extra extensions. (e.g. .zip.gz)\ + eprintln!( + "\tThere is a limitation for .zip archives with extra extensions. (e.g. .zip.gz)\ \n\tThe design of .zip makes it impossible to compress via stream, so it must be done entirely in memory.\ - \n\tBy compressing .zip with extra compression formats, you can run out of RAM if the file is too large!"); + \n\tBy compressing .zip with extra compression formats, you can run out of RAM if the file is too large!" + ); // give user the option to continue decompressing after warning is shown if !user_wants_to_continue_decompressing(input_file_path, question_policy)? { @@ -562,7 +566,7 @@ fn list_archive_contents( archive_path: &Path, formats: Vec, list_options: ListOptions, - question_policy: QuestionPolicy + question_policy: QuestionPolicy, ) -> crate::Result<()> { let reader = fs::File::open(&archive_path)?; @@ -605,9 +609,11 @@ fn list_archive_contents( Tar => crate::archive::tar::list_archive(reader)?, Zip => { eprintln!("{orange}[WARNING]{reset}", orange = *colors::ORANGE, reset = *colors::RESET); - eprintln!("\tThere is a limitation for .zip archives with extra extensions. (e.g. .zip.gz)\ + eprintln!( + "\tThere is a limitation for .zip archives with extra extensions. (e.g. .zip.gz)\ \n\tThe design of .zip makes it impossible to compress via stream, so it must be done entirely in memory.\ - \n\tBy compressing .zip with extra compression formats, you can run out of RAM if the file is too large!"); + \n\tBy compressing .zip with extra compression formats, you can run out of RAM if the file is too large!" + ); // give user the option to continue decompressing after warning is shown if !user_wants_to_continue_decompressing(archive_path, question_policy)? { diff --git a/src/utils/mod.rs b/src/utils/mod.rs index 83f58b9..d7b7aad 100644 --- a/src/utils/mod.rs +++ b/src/utils/mod.rs @@ -8,22 +8,13 @@ mod formatting; mod fs; mod question; -pub use formatting::{ - concatenate_os_str_list, nice_directory_display, - strip_cur_dir, to_utf, Bytes -}; -pub use fs::{ - cd_into_same_dir_as, clear_path, create_dir_if_non_existent, - dir_is_empty, try_infer_extension -}; +pub use formatting::{concatenate_os_str_list, nice_directory_display, strip_cur_dir, to_utf, Bytes}; +pub use fs::{cd_into_same_dir_as, clear_path, create_dir_if_non_existent, dir_is_empty, try_infer_extension}; pub use question::{ - user_wants_to_continue_compressing, user_wants_to_continue_decompressing, - create_or_ask_overwrite, user_wants_to_overwrite, - QuestionPolicy -}; -pub use utf8::{ - get_invalid_utf8_paths, is_invalid_utf8 + create_or_ask_overwrite, user_wants_to_continue_compressing, user_wants_to_continue_decompressing, + user_wants_to_overwrite, QuestionPolicy, }; +pub use utf8::{get_invalid_utf8_paths, is_invalid_utf8}; mod utf8 { use std::{ffi::OsStr, path::PathBuf}; -- 2.11.4.GIT