mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 11:37:44 +00:00
clippy: fix warnings introduced with Rust 1.67.0
This commit is contained in:
parent
fc7e51a4f8
commit
f6b646e4e5
172 changed files with 835 additions and 1034 deletions
|
@ -55,7 +55,7 @@ fn test_mv_move_file_into_dir() {
|
|||
|
||||
ucmd.arg(file).arg(dir).succeeds().no_stderr();
|
||||
|
||||
assert!(at.file_exists(&format!("{}/{}", dir, file)));
|
||||
assert!(at.file_exists(&format!("{dir}/{file}")));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -67,17 +67,17 @@ fn test_mv_move_file_between_dirs() {
|
|||
|
||||
at.mkdir(dir1);
|
||||
at.mkdir(dir2);
|
||||
at.touch(&format!("{}/{}", dir1, file));
|
||||
at.touch(&format!("{dir1}/{file}"));
|
||||
|
||||
assert!(at.file_exists(&format!("{}/{}", dir1, file)));
|
||||
assert!(at.file_exists(&format!("{dir1}/{file}")));
|
||||
|
||||
ucmd.arg(&format!("{}/{}", dir1, file))
|
||||
ucmd.arg(&format!("{dir1}/{file}"))
|
||||
.arg(dir2)
|
||||
.succeeds()
|
||||
.no_stderr();
|
||||
|
||||
assert!(!at.file_exists(&format!("{}/{}", dir1, file)));
|
||||
assert!(at.file_exists(&format!("{}/{}", dir2, file)));
|
||||
assert!(!at.file_exists(&format!("{dir1}/{file}")));
|
||||
assert!(at.file_exists(&format!("{dir2}/{file}")));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -94,7 +94,7 @@ fn test_mv_strip_slashes() {
|
|||
|
||||
scene.ucmd().arg(&source).arg(dir).fails();
|
||||
|
||||
assert!(!at.file_exists(&format!("{}/{}", dir, file)));
|
||||
assert!(!at.file_exists(&format!("{dir}/{file}")));
|
||||
|
||||
scene
|
||||
.ucmd()
|
||||
|
@ -104,7 +104,7 @@ fn test_mv_strip_slashes() {
|
|||
.succeeds()
|
||||
.no_stderr();
|
||||
|
||||
assert!(at.file_exists(&format!("{}/{}", dir, file)));
|
||||
assert!(at.file_exists(&format!("{dir}/{file}")));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -124,8 +124,8 @@ fn test_mv_multiple_files() {
|
|||
.succeeds()
|
||||
.no_stderr();
|
||||
|
||||
assert!(at.file_exists(&format!("{}/{}", target_dir, file_a)));
|
||||
assert!(at.file_exists(&format!("{}/{}", target_dir, file_b)));
|
||||
assert!(at.file_exists(&format!("{target_dir}/{file_a}")));
|
||||
assert!(at.file_exists(&format!("{target_dir}/{file_b}")));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -145,8 +145,8 @@ fn test_mv_multiple_folders() {
|
|||
.succeeds()
|
||||
.no_stderr();
|
||||
|
||||
assert!(at.dir_exists(&format!("{}/{}", target_dir, dir_a)));
|
||||
assert!(at.dir_exists(&format!("{}/{}", target_dir, dir_b)));
|
||||
assert!(at.dir_exists(&format!("{target_dir}/{dir_a}")));
|
||||
assert!(at.dir_exists(&format!("{target_dir}/{dir_b}")));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -262,10 +262,10 @@ fn test_mv_same_file() {
|
|||
let file_a = "test_mv_same_file_a";
|
||||
|
||||
at.touch(file_a);
|
||||
ucmd.arg(file_a).arg(file_a).fails().stderr_is(format!(
|
||||
"mv: '{f}' and '{f}' are the same file\n",
|
||||
f = file_a,
|
||||
));
|
||||
ucmd.arg(file_a)
|
||||
.arg(file_a)
|
||||
.fails()
|
||||
.stderr_is(format!("mv: '{file_a}' and '{file_a}' are the same file\n",));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -275,8 +275,7 @@ fn test_mv_same_file_not_dot_dir() {
|
|||
|
||||
at.mkdir(dir);
|
||||
ucmd.arg(dir).arg(dir).fails().stderr_is(format!(
|
||||
"mv: cannot move '{d}' to a subdirectory of itself, '{d}/{d}'\n",
|
||||
d = dir,
|
||||
"mv: cannot move '{dir}' to a subdirectory of itself, '{dir}/{dir}'\n",
|
||||
));
|
||||
}
|
||||
|
||||
|
@ -306,7 +305,7 @@ fn test_mv_simple_backup() {
|
|||
|
||||
assert!(!at.file_exists(file_a));
|
||||
assert!(at.file_exists(file_b));
|
||||
assert!(at.file_exists(&format!("{}~", file_b)));
|
||||
assert!(at.file_exists(&format!("{file_b}~")));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -325,7 +324,7 @@ fn test_mv_simple_backup_with_file_extension() {
|
|||
|
||||
assert!(!at.file_exists(file_a));
|
||||
assert!(at.file_exists(file_b));
|
||||
assert!(at.file_exists(&format!("{}~", file_b)));
|
||||
assert!(at.file_exists(&format!("{file_b}~")));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -340,7 +339,7 @@ fn test_mv_arg_backup_arg_first() {
|
|||
|
||||
assert!(!at.file_exists(file_a));
|
||||
assert!(at.file_exists(file_b));
|
||||
assert!(at.file_exists(&format!("{}~", file_b)));
|
||||
assert!(at.file_exists(&format!("{file_b}~")));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -353,7 +352,7 @@ fn test_mv_custom_backup_suffix() {
|
|||
at.touch(file_a);
|
||||
at.touch(file_b);
|
||||
ucmd.arg("-b")
|
||||
.arg(format!("--suffix={}", suffix))
|
||||
.arg(format!("--suffix={suffix}"))
|
||||
.arg(file_a)
|
||||
.arg(file_b)
|
||||
.succeeds()
|
||||
|
@ -361,7 +360,7 @@ fn test_mv_custom_backup_suffix() {
|
|||
|
||||
assert!(!at.file_exists(file_a));
|
||||
assert!(at.file_exists(file_b));
|
||||
assert!(at.file_exists(&format!("{}{}", file_b, suffix)));
|
||||
assert!(at.file_exists(&format!("{file_b}{suffix}")));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -374,7 +373,7 @@ fn test_mv_custom_backup_suffix_hyphen_value() {
|
|||
at.touch(file_a);
|
||||
at.touch(file_b);
|
||||
ucmd.arg("-b")
|
||||
.arg(format!("--suffix={}", suffix))
|
||||
.arg(format!("--suffix={suffix}"))
|
||||
.arg(file_a)
|
||||
.arg(file_b)
|
||||
.succeeds()
|
||||
|
@ -382,7 +381,7 @@ fn test_mv_custom_backup_suffix_hyphen_value() {
|
|||
|
||||
assert!(!at.file_exists(file_a));
|
||||
assert!(at.file_exists(file_b));
|
||||
assert!(at.file_exists(&format!("{}{}", file_b, suffix)));
|
||||
assert!(at.file_exists(&format!("{file_b}{suffix}")));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -402,7 +401,7 @@ fn test_mv_custom_backup_suffix_via_env() {
|
|||
|
||||
assert!(!at.file_exists(file_a));
|
||||
assert!(at.file_exists(file_b));
|
||||
assert!(at.file_exists(&format!("{}{}", file_b, suffix)));
|
||||
assert!(at.file_exists(&format!("{file_b}{suffix}")));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -421,7 +420,7 @@ fn test_mv_backup_numbered_with_t() {
|
|||
|
||||
assert!(!at.file_exists(file_a));
|
||||
assert!(at.file_exists(file_b));
|
||||
assert!(at.file_exists(&format!("{}.~1~", file_b)));
|
||||
assert!(at.file_exists(&format!("{file_b}.~1~")));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -440,7 +439,7 @@ fn test_mv_backup_numbered() {
|
|||
|
||||
assert!(!at.file_exists(file_a));
|
||||
assert!(at.file_exists(file_b));
|
||||
assert!(at.file_exists(&format!("{}.~1~", file_b)));
|
||||
assert!(at.file_exists(&format!("{file_b}.~1~")));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -459,7 +458,7 @@ fn test_mv_backup_existing() {
|
|||
|
||||
assert!(!at.file_exists(file_a));
|
||||
assert!(at.file_exists(file_b));
|
||||
assert!(at.file_exists(&format!("{}~", file_b)));
|
||||
assert!(at.file_exists(&format!("{file_b}~")));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -478,7 +477,7 @@ fn test_mv_backup_nil() {
|
|||
|
||||
assert!(!at.file_exists(file_a));
|
||||
assert!(at.file_exists(file_b));
|
||||
assert!(at.file_exists(&format!("{}~", file_b)));
|
||||
assert!(at.file_exists(&format!("{file_b}~")));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -499,7 +498,7 @@ fn test_mv_numbered_if_existing_backup_existing() {
|
|||
|
||||
assert!(at.file_exists(file_b));
|
||||
assert!(at.file_exists(file_b_backup));
|
||||
assert!(at.file_exists(&format!("{}.~2~", file_b)));
|
||||
assert!(at.file_exists(&format!("{file_b}.~2~")));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -520,7 +519,7 @@ fn test_mv_numbered_if_existing_backup_nil() {
|
|||
|
||||
assert!(at.file_exists(file_b));
|
||||
assert!(at.file_exists(file_b_backup));
|
||||
assert!(at.file_exists(&format!("{}.~2~", file_b)));
|
||||
assert!(at.file_exists(&format!("{file_b}.~2~")));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -539,7 +538,7 @@ fn test_mv_backup_simple() {
|
|||
|
||||
assert!(!at.file_exists(file_a));
|
||||
assert!(at.file_exists(file_b));
|
||||
assert!(at.file_exists(&format!("{}~", file_b)));
|
||||
assert!(at.file_exists(&format!("{file_b}~")));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -558,7 +557,7 @@ fn test_mv_backup_never() {
|
|||
|
||||
assert!(!at.file_exists(file_a));
|
||||
assert!(at.file_exists(file_b));
|
||||
assert!(at.file_exists(&format!("{}~", file_b)));
|
||||
assert!(at.file_exists(&format!("{file_b}~")));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -577,7 +576,7 @@ fn test_mv_backup_none() {
|
|||
|
||||
assert!(!at.file_exists(file_a));
|
||||
assert!(at.file_exists(file_b));
|
||||
assert!(!at.file_exists(&format!("{}~", file_b)));
|
||||
assert!(!at.file_exists(&format!("{file_b}~")));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -596,7 +595,7 @@ fn test_mv_backup_off() {
|
|||
|
||||
assert!(!at.file_exists(file_a));
|
||||
assert!(at.file_exists(file_b));
|
||||
assert!(!at.file_exists(&format!("{}~", file_b)));
|
||||
assert!(!at.file_exists(&format!("{file_b}~")));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -661,8 +660,8 @@ fn test_mv_target_dir() {
|
|||
|
||||
assert!(!at.file_exists(file_a));
|
||||
assert!(!at.file_exists(file_b));
|
||||
assert!(at.file_exists(&format!("{}/{}", dir, file_a)));
|
||||
assert!(at.file_exists(&format!("{}/{}", dir, file_b)));
|
||||
assert!(at.file_exists(&format!("{dir}/{file_a}")));
|
||||
assert!(at.file_exists(&format!("{dir}/{file_b}")));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -676,7 +675,7 @@ fn test_mv_target_dir_single_source() {
|
|||
ucmd.arg("-t").arg(dir).arg(file).succeeds().no_stderr();
|
||||
|
||||
assert!(!at.file_exists(file));
|
||||
assert!(at.file_exists(&format!("{}/{}", dir, file)));
|
||||
assert!(at.file_exists(&format!("{dir}/{file}")));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -729,14 +728,11 @@ fn test_mv_backup_dir() {
|
|||
.arg(dir_a)
|
||||
.arg(dir_b)
|
||||
.succeeds()
|
||||
.stdout_only(format!(
|
||||
"'{}' -> '{}' (backup: '{}~')\n",
|
||||
dir_a, dir_b, dir_b
|
||||
));
|
||||
.stdout_only(format!("'{dir_a}' -> '{dir_b}' (backup: '{dir_b}~')\n"));
|
||||
|
||||
assert!(!at.dir_exists(dir_a));
|
||||
assert!(at.dir_exists(dir_b));
|
||||
assert!(at.dir_exists(&format!("{}~", dir_b)));
|
||||
assert!(at.dir_exists(&format!("{dir_b}~")));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -772,8 +768,7 @@ fn test_mv_errors() {
|
|||
.arg(dir)
|
||||
.fails()
|
||||
.stderr_is(format!(
|
||||
"mv: cannot overwrite directory '{}' with non-directory\n",
|
||||
dir
|
||||
"mv: cannot overwrite directory '{dir}' with non-directory\n"
|
||||
));
|
||||
|
||||
// $ at.mkdir dir && at.touch file
|
||||
|
@ -805,7 +800,7 @@ fn test_mv_verbose() {
|
|||
.arg(file_a)
|
||||
.arg(file_b)
|
||||
.succeeds()
|
||||
.stdout_only(format!("'{}' -> '{}'\n", file_a, file_b));
|
||||
.stdout_only(format!("'{file_a}' -> '{file_b}'\n"));
|
||||
|
||||
at.touch(file_a);
|
||||
scene
|
||||
|
@ -814,10 +809,7 @@ fn test_mv_verbose() {
|
|||
.arg(file_a)
|
||||
.arg(file_b)
|
||||
.succeeds()
|
||||
.stdout_only(format!(
|
||||
"'{}' -> '{}' (backup: '{}~')\n",
|
||||
file_a, file_b, file_b
|
||||
));
|
||||
.stdout_only(format!("'{file_a}' -> '{file_b}' (backup: '{file_b}~')\n"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue