Skip to content

Commit 8685694

Browse files
authored
Merge pull request #6581 from BenWiederhake/dev-nightly-clippy
Fix nightly clippy
2 parents 84f8b7a + 584d91f commit 8685694

File tree

17 files changed

+47
-50
lines changed

17 files changed

+47
-50
lines changed

src/uu/cat/src/cat.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -623,10 +623,10 @@ fn write_nonprint_to_end<W: Write>(in_buf: &[u8], writer: &mut W, tab: &[u8]) ->
623623
9 => writer.write_all(tab),
624624
0..=8 | 10..=31 => writer.write_all(&[b'^', byte + 64]),
625625
32..=126 => writer.write_all(&[byte]),
626-
127 => writer.write_all(&[b'^', b'?']),
626+
127 => writer.write_all(b"^?"),
627627
128..=159 => writer.write_all(&[b'M', b'-', b'^', byte - 64]),
628628
160..=254 => writer.write_all(&[b'M', b'-', byte - 128]),
629-
_ => writer.write_all(&[b'M', b'-', b'^', b'?']),
629+
_ => writer.write_all(b"M-^?"),
630630
}
631631
.unwrap();
632632
count += 1;

src/uucore/src/lib/features/encoding.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ pub fn decode(f: Format, input: &[u8]) -> DecodeResult {
8686
Z85 => {
8787
// The z85 crate implements a padded encoding by using a leading '#' which is otherwise not allowed.
8888
// We manually check for a leading '#' and return an error ourselves.
89-
if input.starts_with(&[b'#']) {
89+
if input.starts_with(b"#") {
9090
return Err(z85::DecodeError::InvalidByte(0, b'#').into());
9191
} else {
9292
z85::decode(input)?

src/uucore/src/lib/features/proc_info.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
use std::{
2323
collections::{HashMap, HashSet},
2424
fmt::{self, Display, Formatter},
25-
fs,
25+
fs, io,
2626
path::PathBuf,
2727
rc::Rc,
2828
};

src/uucore/src/lib/features/sum.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ impl<'a> DigestWriter<'a> {
402402

403403
pub fn finalize(&mut self) -> bool {
404404
if self.was_last_character_carriage_return {
405-
self.digest.hash_update(&[b'\r']);
405+
self.digest.hash_update(b"\r");
406406
true
407407
} else {
408408
false
@@ -433,7 +433,7 @@ impl<'a> Write for DigestWriter<'a> {
433433
// call to `write()`.
434434
let n = buf.len();
435435
if self.was_last_character_carriage_return && n > 0 && buf[0] != b'\n' {
436-
self.digest.hash_update(&[b'\r']);
436+
self.digest.hash_update(b"\r");
437437
}
438438

439439
// Next, find all occurrences of "\r\n", inputting the slice
@@ -491,15 +491,15 @@ mod tests {
491491
// Writing "\r" in one call to `write()`, and then "\n" in another.
492492
let mut digest = Box::new(Md5::new()) as Box<dyn Digest>;
493493
let mut writer_crlf = DigestWriter::new(&mut digest, false);
494-
writer_crlf.write_all(&[b'\r']).unwrap();
495-
writer_crlf.write_all(&[b'\n']).unwrap();
494+
writer_crlf.write_all(b"\r").unwrap();
495+
writer_crlf.write_all(b"\n").unwrap();
496496
writer_crlf.finalize();
497497
let result_crlf = digest.result_str();
498498

499499
// We expect "\r\n" to be replaced with "\n" in text mode on Windows.
500500
let mut digest = Box::new(Md5::new()) as Box<dyn Digest>;
501501
let mut writer_lf = DigestWriter::new(&mut digest, false);
502-
writer_lf.write_all(&[b'\n']).unwrap();
502+
writer_lf.write_all(b"\n").unwrap();
503503
writer_lf.finalize();
504504
let result_lf = digest.result_str();
505505

tests/by-util/test_cp.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2028,15 +2028,15 @@ fn test_cp_archive_recursive() {
20282028
let result = scene2
20292029
.cmd("ls")
20302030
.arg("-al")
2031-
.arg(&at.subdir.join(TEST_COPY_TO_FOLDER))
2031+
.arg(at.subdir.join(TEST_COPY_TO_FOLDER))
20322032
.run();
20332033

20342034
println!("ls dest {}", result.stdout_str());
20352035

20362036
let result = scene2
20372037
.cmd("ls")
20382038
.arg("-al")
2039-
.arg(&at.subdir.join(TEST_COPY_TO_FOLDER_NEW))
2039+
.arg(at.subdir.join(TEST_COPY_TO_FOLDER_NEW))
20402040
.run();
20412041

20422042
println!("ls dest {}", result.stdout_str());

tests/by-util/test_hashsum.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ macro_rules! test_digest {
8383
// The asterisk indicates that the digest was computed in
8484
// binary mode.
8585
let n = expected.len();
86-
let expected = [&expected[..n - 3], &[b' ', b'-', b'\n']].concat();
86+
let expected = [&expected[..n - 3], b" -\n"].concat();
8787
new_ucmd!()
8888
.args(&[DIGEST_ARG, BITS_ARG, "-t"])
8989
.pipe_in("a\r\nb\r\nc\r\n")

tests/by-util/test_install.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -962,7 +962,7 @@ fn test_install_dir() {
962962
at.mkdir(dir);
963963
ucmd.arg(file1)
964964
.arg(file2)
965-
.arg(&format!("--target-directory={dir}"))
965+
.arg(format!("--target-directory={dir}"))
966966
.succeeds()
967967
.no_stderr();
968968

tests/by-util/test_join.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ fn wrong_line_order() {
335335
.arg("fields_4.txt")
336336
.fails()
337337
.stdout_contains("7 g f 4 fg")
338-
.stderr_is(&format!(
338+
.stderr_is(format!(
339339
"{0} {1}: fields_4.txt:5: is not sorted: 11 g 5 gh\n{0} {1}: input is not in sorted order\n",
340340
ts.bin_path.to_string_lossy(),
341341
ts.util_name
@@ -347,7 +347,7 @@ fn wrong_line_order() {
347347
.arg("fields_4.txt")
348348
.fails()
349349
.stdout_does_not_contain("7 g f 4 fg")
350-
.stderr_is(&format!(
350+
.stderr_is(format!(
351351
"{0}: fields_4.txt:5: is not sorted: 11 g 5 gh\n",
352352
ts.util_name
353353
));
@@ -361,7 +361,7 @@ fn both_files_wrong_line_order() {
361361
.arg("fields_5.txt")
362362
.fails()
363363
.stdout_contains("5 e 3 ef")
364-
.stderr_is(&format!(
364+
.stderr_is(format!(
365365
"{0} {1}: fields_5.txt:4: is not sorted: 3\n{0} {1}: fields_4.txt:5: is not sorted: 11 g 5 gh\n{0} {1}: input is not in sorted order\n",
366366
ts.bin_path.to_string_lossy(),
367367
ts.util_name
@@ -373,7 +373,7 @@ fn both_files_wrong_line_order() {
373373
.arg("fields_5.txt")
374374
.fails()
375375
.stdout_does_not_contain("5 e 3 ef")
376-
.stderr_is(&format!(
376+
.stderr_is(format!(
377377
"{0}: fields_5.txt:4: is not sorted: 3\n",
378378
ts.util_name
379379
));

tests/by-util/test_ls.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ fn test_invalid_value_returns_1() {
7575
"--time",
7676
] {
7777
new_ucmd!()
78-
.arg(&format!("{flag}=definitely_invalid_value"))
78+
.arg(format!("{flag}=definitely_invalid_value"))
7979
.fails()
8080
.no_stdout()
8181
.code_is(1);
@@ -87,7 +87,7 @@ fn test_invalid_value_returns_2() {
8787
// Invalid values to flags *sometimes* result in error code 2:
8888
for flag in ["--block-size", "--width", "--tab-size"] {
8989
new_ucmd!()
90-
.arg(&format!("{flag}=definitely_invalid_value"))
90+
.arg(format!("{flag}=definitely_invalid_value"))
9191
.fails()
9292
.no_stdout()
9393
.code_is(2);

tests/by-util/test_mv.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ fn test_mv_move_file_between_dirs() {
133133

134134
assert!(at.file_exists(format!("{dir1}/{file}")));
135135

136-
ucmd.arg(&format!("{dir1}/{file}"))
136+
ucmd.arg(format!("{dir1}/{file}"))
137137
.arg(dir2)
138138
.succeeds()
139139
.no_stderr();

0 commit comments

Comments
 (0)