1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-27 19:17:43 +00:00

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.
This commit is contained in:
Andreas Hartmann 2021-07-25 09:40:37 +02:00
parent 4f235e9e95
commit ce037bdf55

View file

@ -502,7 +502,7 @@ fn standard(mut paths: Vec<String>, b: Behavior) -> UResult<()> {
} }
if target.is_file() || is_new_file_path(&target) { if target.is_file() || is_new_file_path(&target) {
copy_file_to_file(&sources[0], &target, &b) copy(&sources[0], &target, &b)
} else { } else {
Err(InstallError::InvalidTarget(target).into()) 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(); let filename = sourcepath.components().last().unwrap();
targetpath.push(filename); targetpath.push(filename);
if let Err(e) = copy(sourcepath, &targetpath, b) { show_if_err!(copy(sourcepath, &targetpath, b));
show!(e);
}
} }
// If the exit code was set, or show! has been called at least once // 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 // (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(()) 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. /// Copy one file to a new location, changing metadata.
/// ///
/// Returns a Result type with the Err variant containing the error message. /// Returns a Result type with the Err variant containing the error message.