Skip to content

Commit 61e6b73

Browse files
committed
refactor(rm/linux): reformat prompt_yes! macros for improved readability
Refactored multiple call sites of the prompt_yes! macro in linux.rs to use consistent multi-line formatting, enhancing code readability and adhering to style guidelines without altering functionality. Adjusted import ordering slightly for better organization.
1 parent 6edfaa0 commit 61e6b73

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

src/uu/rm/src/platform/linux.rs

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
use indicatif::ProgressBar;
1111
use std::ffi::OsStr;
1212
use std::fs;
13-
use std::io::{self, stdin, IsTerminal};
14-
use std::path::Path;
13+
use std::io::{self, IsTerminal, stdin};
1514
use std::os::unix::fs::PermissionsExt;
15+
use std::path::Path;
1616
use uucore::display::Quotable;
1717
use uucore::error::FromIo;
1818
use uucore::prompt_yes;
@@ -65,7 +65,10 @@ fn prompt_file_with_stat(path: &Path, stat: &libc::stat, options: &Options) -> b
6565
(false, _) if options.interactive == InteractiveMode::PromptProtected => true,
6666
(_, true) => true,
6767
(_, false) if len == 0 => {
68-
prompt_yes!("remove write-protected regular empty file {}?", path.quote())
68+
prompt_yes!(
69+
"remove write-protected regular empty file {}?",
70+
path.quote()
71+
)
6972
}
7073
_ => prompt_yes!("remove write-protected regular file {}?", path.quote()),
7174
}
@@ -84,9 +87,15 @@ fn prompt_dir_with_mode(path: &Path, mode: libc::mode_t, options: &Options) -> b
8487
match (stdin_ok, readable, writable, options.interactive) {
8588
(false, _, _, InteractiveMode::PromptProtected) => true,
8689
(false, false, false, InteractiveMode::Never) => true,
87-
(_, false, false, _) => prompt_yes!("attempt removal of inaccessible directory {}?", path.quote()),
90+
(_, false, false, _) => prompt_yes!(
91+
"attempt removal of inaccessible directory {}?",
92+
path.quote()
93+
),
8894
(_, false, true, InteractiveMode::Always) => {
89-
prompt_yes!("attempt removal of inaccessible directory {}?", path.quote())
95+
prompt_yes!(
96+
"attempt removal of inaccessible directory {}?",
97+
path.quote()
98+
)
9099
}
91100
(_, true, false, _) => prompt_yes!("remove write-protected directory {}?", path.quote()),
92101
(_, _, _, InteractiveMode::Always) => prompt_yes!("remove directory {}?", path.quote()),

0 commit comments

Comments
 (0)