Fix byte_char_slices clippy warnings

BUG=b:365852007

Change-Id: I18bfdcc077cc871ea98e9d6deed5514a6e7d2aa5
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5852613
Reviewed-by: Chih-Yang Hsia <paulhsia@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
This commit is contained in:
Daniel Verkamp 2024-09-10 14:46:04 -07:00 committed by crosvm LUCI
parent 15aa2ec8b7
commit d6976ef66b
3 changed files with 23 additions and 23 deletions

View file

@ -109,7 +109,7 @@ fn syslogger_char() {
}
syslogger
.write_all(&[b'\n'])
.write_all(b"\n")
.expect("error writing newline char");
std::mem::drop(syslogger);

View file

@ -165,10 +165,10 @@ mod tests {
Vec::new(),
);
debugcon.write(ADDR, &[b'a']);
debugcon.write(ADDR, &[b'b']);
debugcon.write(ADDR, &[b'c']);
assert_eq!(debugcon_out.buf.lock().as_slice(), [b'a', b'b', b'c']);
debugcon.write(ADDR, b"a");
debugcon.write(ADDR, b"b");
debugcon.write(ADDR, b"c");
assert_eq!(debugcon_out.buf.lock().as_slice(), b"abc");
}
#[test]

View file

@ -679,10 +679,10 @@ mod tests {
Vec::new(),
);
serial.write(serial_bus_address(DATA), &[b'a']);
serial.write(serial_bus_address(DATA), &[b'b']);
serial.write(serial_bus_address(DATA), &[b'c']);
assert_eq!(serial_out.buf.lock().as_slice(), &[b'a', b'b', b'c']);
serial.write(serial_bus_address(DATA), b"a");
serial.write(serial_bus_address(DATA), b"b");
serial.write(serial_bus_address(DATA), b"c");
assert_eq!(serial_out.buf.lock().as_slice(), b"abc");
}
#[test]
@ -701,7 +701,7 @@ mod tests {
);
serial.write(serial_bus_address(IER), &[IER_RECV_BIT]);
serial.queue_input_bytes(&[b'a', b'b', b'c']).unwrap();
serial.queue_input_bytes(b"abc").unwrap();
assert_eq!(intr_evt.wait(), Ok(()));
let mut data = [0u8; 1];
@ -729,7 +729,7 @@ mod tests {
);
serial.write(serial_bus_address(IER), &[IER_RECV_BIT]);
serial.queue_input_bytes(&[b'a', b'b', b'c']).unwrap();
serial.queue_input_bytes(b"abc").unwrap();
assert_eq!(intr_evt.wait(), Ok(()));
let mut data = [0u8; 1];
@ -778,7 +778,7 @@ mod tests {
);
serial.write(serial_bus_address(IER), &[IER_RECV_BIT]);
serial.queue_input_bytes(&[b'a', b'b', b'c']).unwrap();
serial.queue_input_bytes(b"abc").unwrap();
assert_eq!(intr_evt.wait(), Ok(()));
let mut data = [0u8; 1];
@ -817,7 +817,7 @@ mod tests {
);
serial.write(serial_bus_address(IER), &[IER_RECV_BIT]);
serial.queue_input_bytes(&[b'a', b'b', b'c']).unwrap();
serial.queue_input_bytes(b"abc").unwrap();
assert_eq!(intr_evt.wait(), Ok(()));
let mut data = [0u8; 1];
@ -826,7 +826,7 @@ mod tests {
// Take snapshot after reading b'a'. Serial still contains b'b' and b'c'.
let snap = serial.snapshot().expect("failed to snapshot serial");
serial.clear_in_buffer();
serial.queue_input_bytes(&[b'a', b'b', b'c']).unwrap();
serial.queue_input_bytes(b"abc").unwrap();
serial.read(serial_bus_address(DATA), &mut data[..]);
assert_eq!(data[0], b'a');
serial.read(serial_bus_address(DATA), &mut data[..]);
@ -864,7 +864,7 @@ mod tests {
);
serial.write(serial_bus_address(IER), &[IER_RECV_BIT]);
serial.queue_input_bytes(&[b'a', b'b', b'c']).unwrap();
serial.queue_input_bytes(b"abc").unwrap();
assert_eq!(intr_evt.wait(), Ok(()));
let mut data = [0u8; 1];
@ -924,7 +924,7 @@ mod tests {
);
serial.write(serial_bus_address(IER), &[IER_RECV_BIT]);
serial.queue_input_bytes(&[b'a', b'b', b'c']).unwrap();
serial.queue_input_bytes(b"abc").unwrap();
assert_eq!(intr_evt.wait(), Ok(()));
let mut data = [0u8; 1];
@ -948,7 +948,7 @@ mod tests {
fn modify_device(serial: &mut Serial) {
serial.clear_in_buffer();
serial.queue_input_bytes(&[b'a', b'b', b'c']).unwrap();
serial.queue_input_bytes(b"abc").unwrap();
}
suspendable_tests!(
@ -999,18 +999,18 @@ mod tests {
Vec::new(),
);
serial.write(serial_bus_address(DATA), &[b'a']);
serial.write(serial_bus_address(DATA), &[b'\n']);
serial.write(serial_bus_address(DATA), b"a");
serial.write(serial_bus_address(DATA), b"\n");
assert_timestamp_is_present(serial_out.buf.lock().as_slice(), "a");
serial_out.buf.lock().clear();
serial.write(serial_bus_address(DATA), &[b'b']);
serial.write(serial_bus_address(DATA), &[b'\n']);
serial.write(serial_bus_address(DATA), b"b");
serial.write(serial_bus_address(DATA), b"\n");
assert_timestamp_is_present(serial_out.buf.lock().as_slice(), "b");
serial_out.buf.lock().clear();
serial.write(serial_bus_address(DATA), &[b'c']);
serial.write(serial_bus_address(DATA), &[b'\n']);
serial.write(serial_bus_address(DATA), b"c");
serial.write(serial_bus_address(DATA), b"\n");
assert_timestamp_is_present(serial_out.buf.lock().as_slice(), "c");
serial_out.buf.lock().clear();
}