From 91f8a82ca48f8cf288e974724656735a965c6d04 Mon Sep 17 00:00:00 2001 From: ByteDream Date: Wed, 7 Dec 2022 00:39:32 +0100 Subject: [PATCH] Fmt --- crunchy-cli-core/src/cli/download.rs | 7 ++++++- crunchy-cli-core/src/lib.rs | 4 +++- crunchy-cli-core/src/utils/os.rs | 4 +++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/crunchy-cli-core/src/cli/download.rs b/crunchy-cli-core/src/cli/download.rs index b0d0ffa..df48d54 100644 --- a/crunchy-cli-core/src/cli/download.rs +++ b/crunchy-cli-core/src/cli/download.rs @@ -68,7 +68,12 @@ impl Execute for Download { fn pre_check(&self) -> Result<()> { if has_ffmpeg() { debug!("FFmpeg detected") - } else if PathBuf::from(&self.output).extension().unwrap_or_default().to_string_lossy() != "ts" { + } else if PathBuf::from(&self.output) + .extension() + .unwrap_or_default() + .to_string_lossy() + != "ts" + { bail!("File extension is not '.ts'. If you want to use a custom file format, please install ffmpeg") } diff --git a/crunchy-cli-core/src/lib.rs b/crunchy-cli-core/src/lib.rs index c895d51..e8cd52a 100644 --- a/crunchy-cli-core/src/lib.rs +++ b/crunchy-cli-core/src/lib.rs @@ -16,7 +16,9 @@ pub use cli::{archive::Archive, download::Download, login::Login}; #[async_trait::async_trait(?Send)] trait Execute { - fn pre_check(&self) -> Result<()> { Ok(()) } + fn pre_check(&self) -> Result<()> { + Ok(()) + } async fn execute(self, ctx: Context) -> Result<()>; } diff --git a/crunchy-cli-core/src/utils/os.rs b/crunchy-cli-core/src/utils/os.rs index 92e4e9f..e5c00ac 100644 --- a/crunchy-cli-core/src/utils/os.rs +++ b/crunchy-cli-core/src/utils/os.rs @@ -51,5 +51,7 @@ pub fn free_file(mut path: PathBuf) -> PathBuf { /// Sanitizes the given path to not contain any invalid file character. pub fn sanitize_file(path: PathBuf) -> PathBuf { - path.with_file_name(sanitize_filename::sanitize(path.file_name().unwrap().to_string_lossy())) + path.with_file_name(sanitize_filename::sanitize( + path.file_name().unwrap().to_string_lossy(), + )) }