Merge pull request #4272 from cakebaker/mv_remove_unnecessary_not

mv: remove unnecessary "!"
This commit is contained in:
Sylvestre Ledru 2023-01-12 18:32:31 +01:00 committed by GitHub
commit 22821c8ac6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -284,12 +284,12 @@ fn exec(files: &[OsString], b: &Behavior) -> UResult<()> {
if target.is_dir() {
if b.no_target_dir {
if !source.is_dir() {
Err(MvError::DirectoryToNonDirectory(target.quote().to_string()).into())
} else {
if source.is_dir() {
rename(source, target, b, None).map_err_context(|| {
format!("cannot move {} to {}", source.quote(), target.quote())
})
} else {
Err(MvError::DirectoryToNonDirectory(target.quote().to_string()).into())
}
} else {
move_files_into_dir(&[source.clone()], target, b)