From 0a0db41a2c6695d91c4c648fcf3083c6cdb12f4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dorian=20P=C3=A9ron?= Date: Sat, 7 Dec 2024 00:18:18 +0100 Subject: [PATCH] chore(clippy): fix clippy warnings --- src/uucore/src/lib/features/backup_control.rs | 19 ++++++++----------- src/uucore/src/lib/features/proc_info.rs | 9 +++++++++ 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/src/uucore/src/lib/features/backup_control.rs b/src/uucore/src/lib/features/backup_control.rs index 4b4f7aa93..591f57f95 100644 --- a/src/uucore/src/lib/features/backup_control.rs +++ b/src/uucore/src/lib/features/backup_control.rs @@ -667,17 +667,14 @@ mod tests { #[test] fn test_numbered_backup_path() { - assert_eq!(numbered_backup_path(&Path::new("")), PathBuf::from(".~1~")); + assert_eq!(numbered_backup_path(Path::new("")), PathBuf::from(".~1~")); + assert_eq!(numbered_backup_path(Path::new("/")), PathBuf::from("/.~1~")); assert_eq!( - numbered_backup_path(&Path::new("/")), - PathBuf::from("/.~1~") - ); - assert_eq!( - numbered_backup_path(&Path::new("/hello/world")), + numbered_backup_path(Path::new("/hello/world")), PathBuf::from("/hello/world.~1~") ); assert_eq!( - numbered_backup_path(&Path::new("/hello/world/")), + numbered_backup_path(Path::new("/hello/world/")), PathBuf::from("/hello/world.~1~") ); } @@ -685,19 +682,19 @@ mod tests { #[test] fn test_simple_backup_path() { assert_eq!( - simple_backup_path(&Path::new(""), ".bak"), + simple_backup_path(Path::new(""), ".bak"), PathBuf::from(".bak") ); assert_eq!( - simple_backup_path(&Path::new("/"), ".bak"), + simple_backup_path(Path::new("/"), ".bak"), PathBuf::from("/.bak") ); assert_eq!( - simple_backup_path(&Path::new("/hello/world"), ".bak"), + simple_backup_path(Path::new("/hello/world"), ".bak"), PathBuf::from("/hello/world.bak") ); assert_eq!( - simple_backup_path(&Path::new("/hello/world/"), ".bak"), + simple_backup_path(Path::new("/hello/world/"), ".bak"), PathBuf::from("/hello/world.bak") ); } diff --git a/src/uucore/src/lib/features/proc_info.rs b/src/uucore/src/lib/features/proc_info.rs index 7c812ec2a..af5d498d2 100644 --- a/src/uucore/src/lib/features/proc_info.rs +++ b/src/uucore/src/lib/features/proc_info.rs @@ -19,6 +19,15 @@ //! `snice` (TBD) //! +// This file is currently flagged as dead code, because it isn't used anywhere +// in the codebase. It may be useful in the future though, so we decide to keep +// it. +// The code was originally written in procps +// (https://github.com/uutils/procps/blob/main/src/uu/pgrep/src/process.rs) +// but was eventually moved here. +// See https://github.com/uutils/coreutils/pull/6932 for discussion. +#![allow(dead_code)] + use crate::features::tty::Teletype; use std::hash::Hash; use std::{