From 261b4e24d6694fc4be338ddb93751e2364b91442 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Thu, 26 Nov 2020 21:25:40 +0100 Subject: [PATCH] feature(install): remove a duplicate check. Already done in is_new_file_path --- src/uu/install/src/install.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/uu/install/src/install.rs b/src/uu/install/src/install.rs index 2b0aaa4c4..0435bb9ce 100644 --- a/src/uu/install/src/install.rs +++ b/src/uu/install/src/install.rs @@ -390,7 +390,7 @@ fn directory(paths: Vec, b: Behavior) -> i32 { /// Test if the path is a new file path that can be /// created immediately fn is_new_file_path(path: &Path) -> bool { - path.is_file() || !path.exists() && path.parent().map(Path::is_dir).unwrap_or(true) + !path.exists() && path.parent().map(Path::is_dir).unwrap_or(true) } /// Perform an install, given a list of paths and behavior. @@ -409,6 +409,7 @@ fn standard(paths: Vec, b: Behavior) -> i32 { let target = Path::new(paths.last().unwrap()); if (target.is_file() || is_new_file_path(target)) && sources.len() == 1 { + /* If the target already exist or directly creatable */ copy_file_to_file(&sources[0], &target.to_path_buf(), &b) } else { copy_files_into_dir(sources, &target.to_path_buf(), &b)