1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-28 11:37:44 +00:00

mv: simplify condition

This commit is contained in:
Daniel Hofstetter 2024-01-01 16:48:06 +01:00
parent cbf42189a2
commit 01e12120c1

View file

@ -128,13 +128,13 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
let mut app = uu_app();
let matches = app.try_get_matches_from_mut(args)?;
if !matches.contains_id(OPT_TARGET_DIRECTORY)
&& matches
let files: Vec<OsString> = matches
.get_many::<OsString>(ARG_FILES)
.map(|f| f.len())
.unwrap_or(0)
== 1
{
.unwrap_or_default()
.cloned()
.collect();
if files.len() == 1 && !matches.contains_id(OPT_TARGET_DIRECTORY) {
app.error(
ErrorKind::TooFewValues,
format!(
@ -144,12 +144,6 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
.exit();
}
let files: Vec<OsString> = matches
.get_many::<OsString>(ARG_FILES)
.unwrap_or_default()
.cloned()
.collect();
let overwrite_mode = determine_overwrite_mode(&matches);
let backup_mode = backup_control::determine_backup_mode(&matches)?;
let update_mode = update_control::determine_update_mode(&matches);