From e64a0b4a2637a5b84165acf729f41da98b6bb8cf Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Fri, 5 Jan 2024 10:11:35 +0100 Subject: [PATCH] Various fixes Co-authored-by: Daniel Hofstetter --- src/uu/cp/src/copydir.rs | 2 +- src/uu/mv/src/mv.rs | 4 ++-- src/uucore/src/lib/features/fs.rs | 1 - 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/uu/cp/src/copydir.rs b/src/uu/cp/src/copydir.rs index dd3fced53..7a9d797e8 100644 --- a/src/uu/cp/src/copydir.rs +++ b/src/uu/cp/src/copydir.rs @@ -172,7 +172,7 @@ impl Entry { let mut descendant = get_local_to_root_parent(&source_absolute, context.root_parent.as_deref())?; if no_target_dir { - let source_is_dir: bool = direntry.path().is_dir(); + let source_is_dir = direntry.path().is_dir(); if path_ends_with_terminator(context.target) && source_is_dir { if let Err(e) = std::fs::create_dir_all(context.target) { eprintln!("Failed to create directory: {}", e); diff --git a/src/uu/mv/src/mv.rs b/src/uu/mv/src/mv.rs index c95e54028..223ac9119 100644 --- a/src/uu/mv/src/mv.rs +++ b/src/uu/mv/src/mv.rs @@ -318,8 +318,8 @@ fn handle_two_paths(source: &Path, target: &Path, opts: &Options) -> UResult<()> } } - let target_is_dir: bool = target.is_dir(); - let source_is_dir: bool = source.is_dir(); + let target_is_dir = target.is_dir(); + let source_is_dir = source.is_dir(); if path_ends_with_terminator(target) && (!target_is_dir && !source_is_dir) diff --git a/src/uucore/src/lib/features/fs.rs b/src/uucore/src/lib/features/fs.rs index c9eaa1e01..20cc9e13d 100644 --- a/src/uucore/src/lib/features/fs.rs +++ b/src/uucore/src/lib/features/fs.rs @@ -724,7 +724,6 @@ pub fn are_hardlinks_or_one_way_symlink_to_same_file(source: &Path, target: &Pat /// /// * `path` - A reference to the path to be checked. #[cfg(unix)] - pub fn path_ends_with_terminator(path: &Path) -> bool { use std::os::unix::prelude::OsStrExt; path.as_os_str()