mv: rename the variable to match the name in cp

This commit is contained in:
Sylvestre Ledru 2023-12-23 13:05:52 +01:00
parent 3af8ad0fe6
commit 9c7fd5e8cb

View file

@ -434,7 +434,7 @@ pub fn mv(files: &[OsString], opts: &Options) -> UResult<()> {
}
#[allow(clippy::cognitive_complexity)]
fn move_files_into_dir(files: &[PathBuf], target_dir: &Path, opts: &Options) -> UResult<()> {
fn move_files_into_dir(files: &[PathBuf], target_dir: &Path, options: &Options) -> UResult<()> {
// remember the moved destinations for further usage
let mut moved_destinations: HashSet<PathBuf> = HashSet::with_capacity(files.len());
@ -446,7 +446,7 @@ fn move_files_into_dir(files: &[PathBuf], target_dir: &Path, opts: &Options) ->
.canonicalize()
.unwrap_or_else(|_| target_dir.to_path_buf());
let multi_progress = opts.progress_bar.then(MultiProgress::new);
let multi_progress = options.progress_bar.then(MultiProgress::new);
let count_progress = if let Some(ref multi_progress) = multi_progress {
if files.len() > 1 {
@ -475,7 +475,8 @@ fn move_files_into_dir(files: &[PathBuf], target_dir: &Path, opts: &Options) ->
}
};
if moved_destinations.contains(&targetpath) && opts.backup != BackupMode::NumberedBackup {
if moved_destinations.contains(&targetpath) && options.backup != BackupMode::NumberedBackup
{
// If the target file was already created in this mv call, do not overwrite
return Err(USimpleError::new(
1,
@ -509,7 +510,7 @@ fn move_files_into_dir(files: &[PathBuf], target_dir: &Path, opts: &Options) ->
}
}
match rename(sourcepath, &targetpath, opts, multi_progress.as_ref()) {
match rename(sourcepath, &targetpath, options, multi_progress.as_ref()) {
Err(e) if e.to_string().is_empty() => set_exit_code(1),
Err(e) => {
let e = e.map_err_context(|| {