misc: Automatically fix cargo clippy issues added in 1.65 (stable)

The code of the stable branch diverges from the main branch, so we
can't directly backport the corresponding commit to fix the clippy
issues.

See: commit 5e52729453

Signed-off-by: Bo Chen <chen.bo@intel.com>
This commit is contained in:
Bo Chen
2023-01-18 12:43:36 -08:00
committed by Bo Chen
parent 1adfb7e9f8
commit c91a8e1324
60 changed files with 457 additions and 583 deletions

View File

@@ -853,7 +853,7 @@ mod tests {
assert_eq!(pkt.op(), uapi::VSOCK_OP_RESPONSE);
conn
}
other => panic!("invalid ctx state: {:?}", other),
other => panic!("invalid ctx state: {other:?}"),
};
assert_eq!(conn.state, conn_state);
Self {
@@ -971,7 +971,7 @@ mod tests {
// There's no more data in the stream, so `recv_pkt` should yield `VsockError::NoData`.
match ctx.conn.recv_pkt(&mut ctx.pkt) {
Err(VsockError::NoData) => (),
other => panic!("{:?}", other),
other => panic!("{other:?}"),
}
// A recv attempt in an invalid state should yield an instant reset packet.

View File

@@ -234,7 +234,7 @@ mod tests {
txbuf.push(tmp.as_slice()).unwrap();
match txbuf.push(&[1, 2]) {
Err(Error::TxBufFull) => (),
other => panic!("Unexpected result: {:?}", other),
other => panic!("Unexpected result: {other:?}"),
}
}
@@ -267,7 +267,7 @@ mod tests {
sink.set_err(io_err);
match txbuf.flush_to(&mut sink) {
Err(Error::TxBufFlush(ref err)) if err.kind() == ErrorKind::PermissionDenied => (),
other => panic!("Unexpected result: {:?}", other),
other => panic!("Unexpected result: {other:?}"),
}
}
}

View File

@@ -598,7 +598,7 @@ mod tests {
.activate(memory.clone(), Arc::new(NoopVirtioInterrupt {}), Vec::new());
match bad_activate {
Err(ActivateError::BadActivate) => (),
other => panic!("{:?}", other),
other => panic!("{other:?}"),
}
// Test a correct activation.

View File

@@ -851,7 +851,7 @@ mod tests {
None,
)
.unwrap();
let uds_path = format!("test_vsock_{}.sock", name);
let uds_path = format!("test_vsock_{name}.sock");
let muxer = VsockMuxer::new(PEER_CID, uds_path).unwrap();
Self {
@@ -931,7 +931,7 @@ mod tests {
let (local_lsn_count, _) = self.count_epoll_listeners();
assert_eq!(local_lsn_count, init_local_lsn_count + 1);
let buf = format!("CONNECT {}\n", peer_port);
let buf = format!("CONNECT {peer_port}\n");
stream.write_all(buf.as_bytes()).unwrap();
// The muxer would now get notified that data is available for reading from the locally
// initiated connection.
@@ -965,7 +965,7 @@ mod tests {
let mut buf = vec![0u8; 32];
let len = stream.read(&mut buf[..]).unwrap();
assert_eq!(&buf[..len], format!("OK {}\n", local_port).as_bytes());
assert_eq!(&buf[..len], format!("OK {local_port}\n").as_bytes());
(stream, local_port)
}