From e2e28b008fc97dcf8c60e7bfab8dbcf07a1910f9 Mon Sep 17 00:00:00 2001 From: Talison Fabio <54823205+talis-fb@users.noreply.github.com> Date: Sun, 23 Mar 2025 11:39:57 -0300 Subject: [PATCH] chore: cargo fmt --- src/utils/fs.rs | 2 +- src/utils/question.rs | 7 ++----- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/utils/fs.rs b/src/utils/fs.rs index d4cb8a5..c6ffb8a 100644 --- a/src/utils/fs.rs +++ b/src/utils/fs.rs @@ -22,7 +22,7 @@ pub fn is_path_stdin(path: &Path) -> bool { /// Check if &Path exists, if it does then ask the user if they want to overwrite or rename it. /// If the user want to overwrite then the file or directory will be removed and returned the same input path /// If the user want to rename then nothing will be removed and a new path will be returned with a new name -/// +/// /// * `Ok(None)` means the user wants to cancel the operation /// * `Ok(Some(path))` returns a valid PathBuf without any another file or directory with the same name /// * `Err(_)` is an error diff --git a/src/utils/question.rs b/src/utils/question.rs index 781c868..bff7284 100644 --- a/src/utils/question.rs +++ b/src/utils/question.rs @@ -45,7 +45,7 @@ pub enum FileConflitOperation { Cancel, /// Overwrite the existing file with the new one Overwrite, - /// Rename the file + /// Rename the file /// It'll be put "_1" at the end of the filename or "_2","_3","_4".. if already exists Rename, } @@ -223,10 +223,7 @@ impl<'a, T: Default> ChoicePrompt<'a, T> { answer.make_ascii_lowercase(); let answer = answer.trim(); - let chosen_index = self - .choises - .iter() - .position(|choise| choise.label.starts_with(answer)); + let chosen_index = self.choises.iter().position(|choise| choise.label.starts_with(answer)); if let Some(i) = chosen_index { return Ok(self.choises.remove(i).value);