1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-31 13:07:46 +00:00

clippy: simplify code according to nightly 'byte_char_slices' lint

https://rust-lang.github.io/rust-clippy/master/index.html#/byte_char_slices
This commit is contained in:
Ben Wiederhake 2024-07-18 15:14:54 +02:00
parent 84f8b7a98b
commit 471f047a64
6 changed files with 14 additions and 14 deletions

View file

@ -83,7 +83,7 @@ macro_rules! test_digest {
// The asterisk indicates that the digest was computed in
// binary mode.
let n = expected.len();
let expected = [&expected[..n - 3], &[b' ', b'-', b'\n']].concat();
let expected = [&expected[..n - 3], b" -\n"].concat();
new_ucmd!()
.args(&[DIGEST_ARG, BITS_ARG, "-t"])
.pipe_in("a\r\nb\r\nc\r\n")

View file

@ -1434,8 +1434,8 @@ fn check_complement_set2_too_big() {
#[test]
#[cfg(unix)]
fn test_truncate_non_utf8_set() {
let stdin = &[b'\x01', b'a', b'm', b'p', 0xfe_u8, 0xff_u8];
let set1 = OsStr::from_bytes(&[b'a', 0xfe_u8, 0xff_u8, b'z']);
let stdin = b"\x01amp\xfe\xff";
let set1 = OsStr::from_bytes(b"a\xfe\xffz"); // spell-checker:disable-line
let set2 = OsStr::from_bytes(b"01234");
new_ucmd!()

View file

@ -59,7 +59,7 @@ static ALREADY_RUN: &str = " you have already run this UCommand, if you want to
static MULTIPLE_STDIN_MEANINGLESS: &str = "Ucommand is designed around a typical use case of: provide args and input stream -> spawn process -> block until completion -> return output streams. For verifying that a particular section of the input stream is what causes a particular behavior, use the Command type directly.";
static NO_STDIN_MEANINGLESS: &str = "Setting this flag has no effect if there is no stdin";
static END_OF_TRANSMISSION_SEQUENCE: &[u8] = &[b'\n', 0x04];
static END_OF_TRANSMISSION_SEQUENCE: &[u8] = b"\n\x04";
pub const TESTS_BINARY: &str = env!("CARGO_BIN_EXE_coreutils");
pub const PATH: &str = env!("PATH");
@ -3081,7 +3081,7 @@ mod tests {
let result = TestScenario::new("echo").ucmd().arg("Hello world").run();
result.stdout_str_check(|stdout| stdout.ends_with("world\n"));
result.stdout_check(|stdout| stdout.get(0..2).unwrap().eq(&[b'H', b'e']));
result.stdout_check(|stdout| stdout.get(0..2).unwrap().eq(b"He"));
result.no_stderr();
}
@ -3096,7 +3096,7 @@ mod tests {
));
result.stderr_str_check(|stderr| stderr.ends_with("world\n"));
result.stderr_check(|stderr| stderr.get(0..2).unwrap().eq(&[b'H', b'e']));
result.stderr_check(|stdout| stdout.get(0..2).unwrap().eq(b"He"));
result.no_stdout();
}