Skip to content

Commit 604925e

Browse files
committed
fix(rm): remove unused is_writable function and simplify logic
The `is_writable` function was unused and has been removed to clean up the codebase. The logic has been simplified by keeping only the necessary `is_writable_metadata` function, which is now the single source of truth for checking writable permissions. This change reduces code duplication and improves maintainability.
1 parent 8e8941c commit 604925e

File tree

1 file changed

+0
-16
lines changed

1 file changed

+0
-16
lines changed

src/uu/rm/src/rm.rs

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -551,27 +551,11 @@ fn is_writable_metadata(metadata: &Metadata) -> bool {
551551
(mode & 0o200) > 0
552552
}
553553

554-
/// Whether the given file or directory is writable.
555-
#[cfg(unix)]
556-
fn is_writable(path: &Path) -> bool {
557-
match fs::metadata(path) {
558-
Err(_) => false,
559-
Ok(metadata) => is_writable_metadata(&metadata),
560-
}
561-
}
562-
563554
#[cfg(not(unix))]
564555
fn is_writable_metadata(_metadata: &Metadata) -> bool {
565556
true
566557
}
567558

568-
/// Whether the given file or directory is writable.
569-
#[cfg(not(unix))]
570-
fn is_writable(_path: &Path) -> bool {
571-
// TODO Not yet implemented.
572-
true
573-
}
574-
575559
/// Recursively remove the directory tree rooted at the given path.
576560
///
577561
/// If `path` is a file or a symbolic link, just remove it. If it is a

0 commit comments

Comments
 (0)