1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-28 03:27:44 +00:00

chore: manual inline formatting

Minor manual cleanup - inlined many format args.  This makes the code a bit more readable, and helps spot a few inefficiencies and possible bugs.  Note that `&foo` in a `format!` parameter results in a 6% extra performance cost, and does not get inlined by the compiler (yet).
This commit is contained in:
Yuri Astrakhan 2025-04-07 22:56:21 -04:00
parent b7bf8c9467
commit 982805d3cd
29 changed files with 133 additions and 183 deletions

View file

@ -2247,14 +2247,12 @@ mod quoting {
at.mkdir(dirname);
let expected = format!(
"{}:\n{}\n\n{}:\n",
"{}:\n{regular_mode}\n\n{dir_mode}:\n",
match *qt_style {
"shell-always" | "shell-escape-always" => "'.'",
"c" => "\".\"",
_ => ".",
},
regular_mode,
dir_mode
);
scene
@ -4051,7 +4049,7 @@ fn test_ls_path() {
.succeeds()
.stdout_is(expected_stdout);
let abs_path = format!("{}/{}", at.as_string(), path);
let abs_path = format!("{}/{path}", at.as_string());
let expected_stdout = format!("{abs_path}\n");
scene
@ -4160,7 +4158,7 @@ fn test_ls_context1() {
}
let file = "test_ls_context_file";
let expected = format!("unconfined_u:object_r:user_tmp_t:s0 {}\n", file);
let expected = format!("unconfined_u:object_r:user_tmp_t:s0 {file}\n");
let (at, mut ucmd) = at_and_ucmd!();
at.touch(file);
ucmd.args(&["-Z", file]).succeeds().stdout_is(expected);
@ -4204,7 +4202,7 @@ fn test_ls_context_format() {
// "verbose",
"vertical",
] {
let format = format!("--format={}", word);
let format = format!("--format={word}");
ts.ucmd()
.args(&["-Z", format.as_str(), "/"])
.succeeds()