diff --git a/crates/nu-command/src/filesystem/cp.rs b/crates/nu-command/src/filesystem/cp.rs index 4c44b26a60..8c6ea0655a 100644 --- a/crates/nu-command/src/filesystem/cp.rs +++ b/crates/nu-command/src/filesystem/cp.rs @@ -101,7 +101,7 @@ impl Command for Cp { sources.remove(index); } - if sources.len() == 0 { + if sources.is_empty() { return Err(ShellError::NoFileToBeCopied()); } } diff --git a/crates/nu-command/src/filesystem/mv.rs b/crates/nu-command/src/filesystem/mv.rs index 37aa625b8b..fe9b919432 100644 --- a/crates/nu-command/src/filesystem/mv.rs +++ b/crates/nu-command/src/filesystem/mv.rs @@ -87,7 +87,7 @@ impl Command for Mv { sources.remove(index); } - if sources.len() == 0 { + if sources.is_empty() { return Err(ShellError::NoFileToBeMoved()); } } diff --git a/crates/nu-command/src/filesystem/rm.rs b/crates/nu-command/src/filesystem/rm.rs index 0aca771474..48d9126700 100644 --- a/crates/nu-command/src/filesystem/rm.rs +++ b/crates/nu-command/src/filesystem/rm.rs @@ -147,7 +147,7 @@ fn rm(context: &EvaluationContext, call: &Call) -> Result { targets.remove(index); } - if targets.len() == 0 { + if targets.is_empty() { return Err(ShellError::NoFileToBeRemoved()); } }