Correct assorted clippy warnings in test code

Subset of 96a7249b54 from main.
This commit is contained in:
Joseph Birr-Pixton 2024-04-19 15:10:58 +01:00 committed by Joe Birr-Pixton
parent 3587d98f4e
commit 7e0e8ab599
3 changed files with 14 additions and 19 deletions

View File

@ -473,7 +473,7 @@ fn bench_bulk(params: &BenchmarkParam, plaintext_size: u64, max_fragment_size: O
do_handshake(&mut client, &mut server);
let mut buf = vec![0u8; plaintext_size as usize];
let buf = vec![0u8; plaintext_size as usize];
let total_data = apply_work_multiplier(if plaintext_size < 8192 {
64 * 1024 * 1024

View File

@ -659,12 +659,9 @@ fn handle_err(err: Error) -> ! {
fn flush(sess: &mut Connection, conn: &mut net::TcpStream) {
while sess.wants_write() {
match sess.write_tls(conn) {
Err(err) => {
println!("IO error: {:?}", err);
process::exit(0);
}
Ok(_) => {}
if let Err(err) = sess.write_tls(conn) {
println!("IO error: {:?}", err);
process::exit(0);
}
}
conn.flush().unwrap();

View File

@ -42,7 +42,9 @@ fn alpn_test_error(
for version in rustls::ALL_VERSIONS {
let mut client_config = make_client_config_with_versions(KeyType::Rsa, &[version]);
client_config.alpn_protocols = client_protos.clone();
client_config
.alpn_protocols
.clone_from(&client_protos);
let (mut client, mut server) =
make_pair_for_arc_configs(&Arc::new(client_config), &server_config);
@ -3252,7 +3254,7 @@ mod test_quic {
fn test_quic_handshake() {
fn equal_packet_keys(x: &quic::PacketKey, y: &quic::PacketKey) -> bool {
// Check that these two sets of keys are equal.
let mut buf = vec![0; 32];
let mut buf = [0; 32];
let (header, payload_tag) = buf.split_at_mut(8);
let (payload, tag_buf) = payload_tag.split_at_mut(8);
let tag = x
@ -3262,7 +3264,7 @@ mod test_quic {
let result = y.decrypt_in_place(42, &*header, payload_tag);
match result {
Ok(payload) => payload == &[0; 8],
Ok(payload) => payload == [0; 8],
Err(_) => false,
}
}
@ -3606,9 +3608,7 @@ mod test_quic {
let mut buf = Vec::with_capacity(512);
client_hello.encode(&mut buf);
assert_eq!(
server
.read_hs(&mut buf.as_slice())
.err(),
server.read_hs(buf.as_slice()).err(),
Some(Error::PeerMisbehaved(
PeerMisbehaved::MissingQuicTransportParameters
))
@ -3651,7 +3651,7 @@ mod test_quic {
typ: HandshakeType::ClientHello,
payload: HandshakePayload::ClientHello(ClientHelloPayload {
client_version: ProtocolVersion::TLSv1_2,
random: random.clone(),
random,
session_id: SessionId::random().unwrap(),
cipher_suites: vec![CipherSuite::TLS13_AES_128_GCM_SHA256],
compression_methods: vec![Compression::Null],
@ -3669,9 +3669,7 @@ mod test_quic {
let mut buf = Vec::with_capacity(512);
client_hello.encode(&mut buf);
assert_eq!(
server
.read_hs(&mut buf.as_slice())
.err(),
server.read_hs(buf.as_slice()).err(),
Some(Error::PeerIncompatible(
PeerIncompatible::SupportedVersionsExtensionRequired
)),
@ -3712,7 +3710,7 @@ mod test_quic {
0x08, 0x06, 0x04, 0x80, 0x00, 0xff, 0xff,
];
let client_keys = Keys::initial(Version::V1, &CONNECTION_ID, Side::Client);
let client_keys = Keys::initial(Version::V1, CONNECTION_ID, Side::Client);
assert_eq!(
client_keys
.local
@ -3848,7 +3846,7 @@ mod test_quic {
let (first, rest) = header.split_at_mut(1);
let sample = &payload[..sample_len];
let server_keys = Keys::initial(Version::V1, &CONNECTION_ID, Side::Server);
let server_keys = Keys::initial(Version::V1, CONNECTION_ID, Side::Server);
server_keys
.remote
.header