From 59f37d88d017ba613fe90933f560b29f0d088d3d Mon Sep 17 00:00:00 2001 From: Daniel Hofstetter Date: Fri, 4 Nov 2022 08:54:51 +0100 Subject: [PATCH 1/4] rm: fix "needless borrow" clippy warnings --- src/uu/rm/src/rm.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/uu/rm/src/rm.rs b/src/uu/rm/src/rm.rs index f65ebb2fa..5be19893b 100644 --- a/src/uu/rm/src/rm.rs +++ b/src/uu/rm/src/rm.rs @@ -170,7 +170,7 @@ pub fn uu_app() -> Command { Arg::new(OPT_PROMPT) .short('i') .help("prompt before every removal") - .overrides_with_all(&[OPT_PROMPT_MORE, OPT_INTERACTIVE]) + .overrides_with_all([OPT_PROMPT_MORE, OPT_INTERACTIVE]) .action(ArgAction::SetTrue), ) .arg( @@ -178,7 +178,7 @@ pub fn uu_app() -> Command { .short('I') .help("prompt once before removing more than three files, or when removing recursively. \ Less intrusive than -i, while still giving some protection against most mistakes") - .overrides_with_all(&[OPT_PROMPT, OPT_INTERACTIVE]) + .overrides_with_all([OPT_PROMPT, OPT_INTERACTIVE]) .action(ArgAction::SetTrue), ) .arg( @@ -189,7 +189,7 @@ pub fn uu_app() -> Command { prompts always", ) .value_name("WHEN") - .overrides_with_all(&[OPT_PROMPT, OPT_PROMPT_MORE]), + .overrides_with_all([OPT_PROMPT, OPT_PROMPT_MORE]), ) .arg( Arg::new(OPT_ONE_FILE_SYSTEM) From 96ef306cb34bb1cfb9a920065fa47f34d84f1810 Mon Sep 17 00:00:00 2001 From: Daniel Hofstetter Date: Fri, 4 Nov 2022 09:11:24 +0100 Subject: [PATCH 2/4] Fix "unwrap or else default" clippy warning --- src/uucore/src/lib/features/fsext.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uucore/src/lib/features/fsext.rs b/src/uucore/src/lib/features/fsext.rs index f306f34de..68e2b7a55 100644 --- a/src/uucore/src/lib/features/fsext.rs +++ b/src/uucore/src/lib/features/fsext.rs @@ -303,7 +303,7 @@ impl MountInfo { let mut mn_info = Self { dev_id: volume_name, dev_name, - fs_type: fs_type.unwrap_or_else(|| "".to_string()), + fs_type: fs_type.unwrap_or_default(), mount_root, mount_dir: "".to_string(), mount_option: "".to_string(), From 7df36bb1538cb97207e8ff2a16402453a40cd45f Mon Sep 17 00:00:00 2001 From: Daniel Hofstetter Date: Fri, 4 Nov 2022 09:52:09 +0100 Subject: [PATCH 3/4] mv: fix "needless borrow" clippy warnings --- src/uu/mv/src/mv.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/uu/mv/src/mv.rs b/src/uu/mv/src/mv.rs index 4697fac4a..671aea0ad 100644 --- a/src/uu/mv/src/mv.rs +++ b/src/uu/mv/src/mv.rs @@ -475,11 +475,11 @@ fn rename_symlink_fallback(from: &Path, to: &Path) -> io::Result<()> { { if path_symlink_points_to.exists() { if path_symlink_points_to.is_dir() { - windows::fs::symlink_dir(&path_symlink_points_to, &to)?; + windows::fs::symlink_dir(&path_symlink_points_to, to)?; } else { - windows::fs::symlink_file(&path_symlink_points_to, &to)?; + windows::fs::symlink_file(&path_symlink_points_to, to)?; } - fs::remove_file(&from)?; + fs::remove_file(from)?; } else { return Err(io::Error::new( io::ErrorKind::NotFound, From 8114abc95659e4e94b8e2216dc8131aa57d3852b Mon Sep 17 00:00:00 2001 From: Daniel Hofstetter Date: Fri, 4 Nov 2022 11:10:35 +0100 Subject: [PATCH 4/4] Fix "needless borrow" clippy warning in env test --- tests/by-util/test_env.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/by-util/test_env.rs b/tests/by-util/test_env.rs index 3172320f3..9b6452548 100644 --- a/tests/by-util/test_env.rs +++ b/tests/by-util/test_env.rs @@ -220,7 +220,7 @@ fn test_change_directory() { let out = scene .ucmd() .arg("--chdir") - .arg(&temporary_path) + .arg(temporary_path) .args(&pwd) .succeeds() .stdout_move_str();