From 0d56792c58a3f3fa81e312e4d14abe91a0ba1a42 Mon Sep 17 00:00:00 2001 From: John Shin Date: Fri, 28 Jul 2023 17:09:23 -0700 Subject: [PATCH 1/2] mv: use is_empty() --- src/uu/mv/src/mv.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uu/mv/src/mv.rs b/src/uu/mv/src/mv.rs index 32214b302..79245a427 100644 --- a/src/uu/mv/src/mv.rs +++ b/src/uu/mv/src/mv.rs @@ -400,7 +400,7 @@ fn move_files_into_dir(files: &[PathBuf], target_dir: &Path, b: &Behavior) -> UR } match rename(sourcepath, &targetpath, b, multi_progress.as_ref()) { - Err(e) if e.to_string() == "" => set_exit_code(1), + Err(e) if e.to_string().is_empty() => set_exit_code(1), Err(e) => { let e = e.map_err_context(|| { format!( From 426cce7df0b0ef00cefd1fd841096b698551df88 Mon Sep 17 00:00:00 2001 From: John Shin Date: Fri, 28 Jul 2023 17:10:36 -0700 Subject: [PATCH 2/2] rmdir: use is_empty() --- src/uu/rmdir/src/rmdir.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uu/rmdir/src/rmdir.rs b/src/uu/rmdir/src/rmdir.rs index 9a864266a..d0123186f 100644 --- a/src/uu/rmdir/src/rmdir.rs +++ b/src/uu/rmdir/src/rmdir.rs @@ -100,7 +100,7 @@ fn remove(mut path: &Path, opts: Opts) -> Result<(), Error<'_>> { if opts.parents { while let Some(new) = path.parent() { path = new; - if path.as_os_str() == "" { + if path.as_os_str().is_empty() { break; } remove_single(path, opts)?;