refactor: consolidate branches

This commit is contained in:
Juan José Lledó Frasquet 2026-01-12 13:41:00 +01:00
parent 29a610d389
commit b0bb9f19d8

View file

@ -67,18 +67,18 @@ impl Actor for Rename {
return; return;
}; };
if opt.force || !maybe_exists(&new).await || provider::must_identical(&old, &new).await { if !opt.force
if conversion_to_dir_requested && target_is_empty { && maybe_exists(&new).await
Self::replace_file_with_dir(old, new).await.ok(); && !provider::must_identical(&old, &new).await
} else { && !ConfirmProxy::show(ConfirmCfg::overwrite(&new)).await
Self::r#do(tab, old, new).await.ok(); {
} return;
} else if ConfirmProxy::show(ConfirmCfg::overwrite(&new)).await { }
if conversion_to_dir_requested && target_is_empty {
Self::replace_file_with_dir(old, new).await.ok(); if conversion_to_dir_requested && target_is_empty {
} else { Self::replace_file_with_dir(old, new).await.ok();
Self::r#do(tab, old, new).await.ok(); } else {
} Self::r#do(tab, old, new).await.ok();
} }
}); });
succ!(); succ!();