From ce037bdf55bc530768c9e45e2c5da632fab80c7e Mon Sep 17 00:00:00 2001 From: Andreas Hartmann Date: Sun, 25 Jul 2021 09:40:37 +0200 Subject: [PATCH] install: remove obsolete function call The `copy_file_to_file` function was only a wrapper to a `copy` function with the exact same interface. It has now beed removed for clarity. --- src/uu/install/src/install.rs | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/src/uu/install/src/install.rs b/src/uu/install/src/install.rs index 2186738c4..8ce219f7a 100644 --- a/src/uu/install/src/install.rs +++ b/src/uu/install/src/install.rs @@ -502,7 +502,7 @@ fn standard(mut paths: Vec, b: Behavior) -> UResult<()> { } if target.is_file() || is_new_file_path(&target) { - copy_file_to_file(&sources[0], &target, &b) + copy(&sources[0], &target, &b) } else { Err(InstallError::InvalidTarget(target).into()) } @@ -543,9 +543,7 @@ fn copy_files_into_dir(files: &[PathBuf], target_dir: &Path, b: &Behavior) -> UR let filename = sourcepath.components().last().unwrap(); targetpath.push(filename); - if let Err(e) = copy(sourcepath, &targetpath, b) { - show!(e); - } + show_if_err!(copy(sourcepath, &targetpath, b)); } // If the exit code was set, or show! has been called at least once // (which sets the exit code as well), function execution will end after @@ -553,20 +551,6 @@ fn copy_files_into_dir(files: &[PathBuf], target_dir: &Path, b: &Behavior) -> UR Ok(()) } -/// Copy a file to another file. -/// -/// Prints verbose information and error messages. -/// Returns a Result type with the Err variant containing the error message. -/// -/// # Parameters -/// -/// _file_ must exist as a non-directory. -/// _target_ must be a non-directory -/// -fn copy_file_to_file(file: &Path, target: &Path, b: &Behavior) -> UResult<()> { - copy(file, target, b) -} - /// Copy one file to a new location, changing metadata. /// /// Returns a Result type with the Err variant containing the error message.