Skip to content

Commit 87c3dd1

Browse files
committed
run clippy fix with mixed
1 parent 1fd5d52 commit 87c3dd1

10 files changed

Lines changed: 13 additions & 20 deletions

File tree

.clippy.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ avoid-breaking-exported-api = false
33
check-private-items = true
44
cognitive-complexity-threshold = 24
55
missing-docs-in-crate-items = true
6+
allow-mixed-uninlined-format-args = false

src/uu/pr/src/pr.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1264,11 +1264,8 @@ fn header_content(options: &OutputOptions, page: usize) -> Vec<String> {
12641264
let padding_after_filename = space_for_filename - filename_len - padding_before_filename;
12651265

12661266
format!(
1267-
"{date_part}{:width1$}{filename}{:width2$}{page_part}",
1268-
"",
1269-
"",
1270-
width1 = padding_before_filename,
1271-
width2 = padding_after_filename
1267+
"{date_part}{:padding_before_filename$}{filename}{:padding_after_filename$}{page_part}",
1268+
"", ""
12721269
)
12731270
} else {
12741271
// If content is too long, just use single spaces

src/uu/stat/src/stat.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1303,13 +1303,12 @@ impl Stater {
13031303
};
13041304

13051305
format!(
1306-
" {}: %N\n {}: %-10s\t{}: %-10b {} {}: %-6o %F\n{}{}: (%04a/%10.10A) {}: (%5u/%8U) {}: (%5g/%8G)\n{}: %x\n{}: %y\n{}: %z\n {}: %w\n",
1306+
" {}: %N\n {}: %-10s\t{}: %-10b {} {}: %-6o %F\n{device_line}{}: (%04a/%10.10A) {}: (%5u/%8U) {}: (%5g/%8G)\n{}: %x\n{}: %y\n{}: %z\n {}: %w\n",
13071307
translate!("stat-word-file"),
13081308
translate!("stat-word-size"),
13091309
translate!("stat-word-blocks"),
13101310
translate!("stat-word-io"),
13111311
translate!("stat-word-block"),
1312-
device_line,
13131312
translate!("stat-word-access"),
13141313
translate!("stat-word-uid"),
13151314
translate!("stat-word-gid"),

src/uu/tsort/benches/tsort_bench.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ fn generate_linear_chain(num_nodes: usize) -> Vec<u8> {
1212
let mut data = Vec::new();
1313

1414
for i in 0..num_nodes.saturating_sub(1) {
15-
data.extend_from_slice(format!("node{} node{}\n", i, i + 1).as_bytes());
15+
data.extend_from_slice(format!("node{i} node{}\n", i + 1).as_bytes());
1616
}
1717

1818
data

src/uucore/src/lib/features/format/num_format.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,7 @@ fn format_float_scientific(
425425
return if force_decimal == ForceDecimal::Yes && precision == 0 {
426426
format!("0.{exp_char}+00")
427427
} else {
428-
format!("{:.*}{exp_char}+00", precision, 0.0)
428+
format!("{:.precision$}{exp_char}+00", 0.0)
429429
};
430430
}
431431

tests/by-util/test_cp.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6500,8 +6500,7 @@ fn test_cp_archive_preserves_directory_permissions() {
65006500
assert_eq!(
65016501
mode & 0o777,
65026502
0o755,
6503-
"Directory {} has incorrect permissions: {:o}",
6504-
path,
6503+
"Directory {path} has incorrect permissions: {:o}",
65056504
mode & 0o777
65066505
);
65076506
};

tests/by-util/test_date.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -419,8 +419,7 @@ fn test_date_set_hyphen_prefixed_values() {
419419
// permission error, not argument parsing error
420420
assert!(
421421
result.stderr_str().starts_with("date: cannot set date: "),
422-
"Expected permission error for '{}', but got: {}",
423-
date_str,
422+
"Expected permission error for '{date_str}', but got: {}",
424423
result.stderr_str()
425424
);
426425
}

tests/by-util/test_du.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1782,7 +1782,7 @@ fn test_du_long_path_safe_traversal() {
17821782
at.mkdir(&deep_path);
17831783

17841784
for i in 0..15 {
1785-
let long_dir_name = format!("{}{}", "a".repeat(100), i);
1785+
let long_dir_name = format!("{}{i}", "a".repeat(100));
17861786
deep_path = format!("{deep_path}/{long_dir_name}");
17871787
at.mkdir_all(&deep_path);
17881788
}
@@ -1830,7 +1830,7 @@ fn test_du_safe_traversal_with_symlinks() {
18301830
at.mkdir(&deep_path);
18311831

18321832
for i in 0..8 {
1833-
let dir_name = format!("{}{}", "b".repeat(50), i);
1833+
let dir_name = format!("{}{i}", "b".repeat(50));
18341834
deep_path = format!("{deep_path}/{dir_name}");
18351835
at.mkdir_all(&deep_path);
18361836
}

tests/by-util/test_rm.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1103,7 +1103,7 @@ fn test_rm_recursive_long_path_safe_traversal() {
11031103
at.mkdir(&deep_path);
11041104

11051105
for i in 0..12 {
1106-
let long_dir_name = format!("{}{}", "z".repeat(80), i);
1106+
let long_dir_name = format!("{}{i}", "z".repeat(80));
11071107
deep_path = format!("{deep_path}/{long_dir_name}");
11081108
at.mkdir_all(&deep_path);
11091109
}

tests/test_uudoc.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,8 @@ fn get_doc_file_from_output(output: &str) -> (String, String) {
6262
Ok(content) => content,
6363
Err(e) => {
6464
panic!(
65-
"Failed to read file {}: {} from {:?}",
66-
correct_path_test,
67-
e,
68-
env::current_dir()
65+
"Failed to read file {correct_path_test}: {e} from {:?}",
66+
env::current_dir(),
6967
);
7068
}
7169
};

0 commit comments

Comments
 (0)