rm: Remove remove_dir_all dependency

Closes #4335
This commit is contained in:
Yang Hau 2023-02-10 22:51:09 +08:00
parent 830f785220
commit 0b1edd33fc
4 changed files with 3 additions and 24 deletions

16
Cargo.lock generated
View file

@ -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",

View file

@ -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`.

View file

@ -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]

View file

@ -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)