From 0b1edd33fc44846a729096642c9e14d836971f5c Mon Sep 17 00:00:00 2001 From: Yang Hau Date: Fri, 10 Feb 2023 22:51:09 +0800 Subject: [PATCH] rm: Remove remove_dir_all dependency Closes #4335 --- Cargo.lock | 16 +--------------- deny.toml | 5 +---- src/uu/rm/Cargo.toml | 1 - src/uu/rm/src/rm.rs | 5 +---- 4 files changed, 3 insertions(+), 24 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e2b99a4bcb..573c1b6343 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1827,19 +1827,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "remove_dir_all" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "882f368737489ea543bc5c340e6f3d34a28c39980bd9a979e47322b26f60ac40" -dependencies = [ - "libc", - "log", - "num_cpus", - "rayon", - "winapi", -] - [[package]] name = "retain_mut" version = "0.1.7" @@ -2148,7 +2135,7 @@ dependencies = [ "fastrand", "libc", "redox_syscall", - "remove_dir_all 0.5.3", + "remove_dir_all", "winapi", ] @@ -2950,7 +2937,6 @@ version = "0.0.17" dependencies = [ "clap", "libc", - "remove_dir_all 0.7.0", "uucore", "walkdir", "windows-sys", diff --git a/deny.toml b/deny.toml index a2f788f459..20995c9365 100644 --- a/deny.toml +++ b/deny.toml @@ -58,10 +58,7 @@ highlight = "all" # For each duplicate dependency, indicate the name of the dependency which # introduces it. # spell-checker: disable -skip = [ - # tempfile - { name = "remove_dir_all", version = "=0.5.3" }, -] +skip = [] # spell-checker: enable # This section is considered when running `cargo deny check sources`. diff --git a/src/uu/rm/Cargo.toml b/src/uu/rm/Cargo.toml index 9f169b1c02..5952d78672 100644 --- a/src/uu/rm/Cargo.toml +++ b/src/uu/rm/Cargo.toml @@ -17,7 +17,6 @@ path = "src/rm.rs" [dependencies] clap = { version = "4.0", features = ["wrap_help", "cargo"] } walkdir = "2.2" -remove_dir_all = "0.7.0" uucore = { version=">=0.0.17", package="uucore", path="../../uucore", features=["fs"] } [target.'cfg(unix)'.dependencies] diff --git a/src/uu/rm/src/rm.rs b/src/uu/rm/src/rm.rs index ec09181e99..850e18408d 100644 --- a/src/uu/rm/src/rm.rs +++ b/src/uu/rm/src/rm.rs @@ -8,7 +8,6 @@ // spell-checker:ignore (path) eacces use clap::{crate_version, parser::ValueSource, Arg, ArgAction, Command}; -use remove_dir_all::remove_dir_all; use std::collections::VecDeque; use std::fs::{self, File, Metadata}; use std::io::ErrorKind; @@ -298,9 +297,7 @@ fn handle_dir(path: &Path, options: &Options) -> bool { let is_root = path.has_root() && path.parent().is_none(); if options.recursive && (!is_root || !options.preserve_root) { if options.interactive != InteractiveMode::Always && !options.verbose { - // we need the extra crate because apparently fs::remove_dir_all() does not function - // correctly on Windows - if let Err(e) = remove_dir_all(path) { + if let Err(e) = fs::remove_dir_all(path) { had_err = true; if e.kind() == std::io::ErrorKind::PermissionDenied { // GNU compatibility (rm/fail-eacces.sh)