Skip to content

Commit

Permalink
clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
Andy Grover committed Jul 8, 2020
1 parent 15f39d3 commit 6fbbe53
Showing 1 changed file with 27 additions and 10 deletions.
37 changes: 27 additions & 10 deletions neqo-http3/src/connection_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1852,7 +1852,7 @@ mod tests {
if let ConnectionEvent::RecvStreamReadable { stream_id } = e {
if stream_id == request_stream_id {
// Read the DATA frame.
let mut buf = [1_u8; Connection::stream_recv_buffer_size()];
let mut buf = vec![1_u8; Connection::stream_recv_buffer_size()];
let (amount, fin) = server.conn.stream_recv(stream_id, &mut buf).unwrap();
assert_eq!(fin, true);
assert_eq!(
Expand Down Expand Up @@ -1926,7 +1926,7 @@ mod tests {
// The second frame cannot fit.
let sent = client.send_request_body(
request_stream_id,
&[0_u8; Connection::stream_recv_buffer_size()],
&vec![0_u8; Connection::stream_recv_buffer_size()],
);
assert_eq!(sent, Ok(expected_second_data_frame.len()));

Expand All @@ -1946,7 +1946,7 @@ mod tests {
if let ConnectionEvent::RecvStreamReadable { stream_id } = e {
if stream_id == request_stream_id {
// Read DATA frames.
let mut buf = [1_u8; Connection::stream_recv_buffer_size()];
let mut buf = vec![1_u8; Connection::stream_recv_buffer_size()];
let (amount, fin) = server.conn.stream_recv(stream_id, &mut buf).unwrap();
assert_eq!(fin, true);
assert_eq!(
Expand Down Expand Up @@ -1990,6 +1990,7 @@ mod tests {
// Send 2 frames. For the second one we can only send 63 bytes.
// After the first frame there is exactly 63+2 bytes left in the send buffer.
#[test]
#[allow(clippy::useless_vec)]
fn fetch_two_data_frame_second_63bytes() {
const FIRST_FRAME_SIZE: usize = Connection::stream_send_buffer_size() - 88;

Expand All @@ -1999,13 +2000,19 @@ mod tests {
let mut enc = Encoder::default();
data_frame.encode(&mut enc);

fetch_with_two_data_frames(&[0_u8; FIRST_FRAME_SIZE], &enc, &[0x0, 0x3f], &[0_u8; 63]);
fetch_with_two_data_frames(
&vec![0_u8; FIRST_FRAME_SIZE],
&enc,
&[0x0, 0x3f],
&[0_u8; 63],
);
}

// Send 2 frames. For the second one we can only send 63 bytes.
// After the first frame there is exactly 63+3 bytes left in the send buffer,
// but we can only send 63 bytes.
#[test]
#[allow(clippy::useless_vec)]
fn fetch_two_data_frame_second_63bytes_place_for_66() {
const FIRST_FRAME_SIZE: usize = Connection::stream_send_buffer_size() - 89;

Expand All @@ -2015,13 +2022,19 @@ mod tests {
let mut enc = Encoder::default();
data_frame.encode(&mut enc);

fetch_with_two_data_frames(&[0_u8; FIRST_FRAME_SIZE], &enc, &[0x0, 0x3f], &[0_u8; 63]);
fetch_with_two_data_frames(
&vec![0_u8; FIRST_FRAME_SIZE],
&enc,
&[0x0, 0x3f],
&[0_u8; 63],
);
}

// Send 2 frames. For the second one we can only send 64 bytes.
// After the first frame there is exactly 64+3 bytes left in the send buffer,
// but we can only send 64 bytes.
#[test]
#[allow(clippy::useless_vec)]
fn fetch_two_data_frame_second_64bytes_place_for_67() {
const FIRST_FRAME_SIZE: usize = Connection::stream_send_buffer_size() - 90;

Expand All @@ -2032,7 +2045,7 @@ mod tests {
data_frame.encode(&mut enc);

fetch_with_two_data_frames(
&[0_u8; FIRST_FRAME_SIZE],
&vec![0_u8; FIRST_FRAME_SIZE],
&enc,
&[0x0, 0x40, 0x40],
&[0_u8; 64],
Expand All @@ -2042,6 +2055,7 @@ mod tests {
// Send 2 frames. For the second one we can only send 16383 bytes.
// After the first frame there is exactly 16383+3 bytes left in the send buffer.
#[test]
#[allow(clippy::useless_vec)]
fn fetch_two_data_frame_second_16383bytes() {
const FIRST_FRAME_SIZE: usize = Connection::stream_send_buffer_size() - 16409;

Expand All @@ -2052,7 +2066,7 @@ mod tests {
data_frame.encode(&mut enc);

fetch_with_two_data_frames(
&[0_u8; FIRST_FRAME_SIZE],
&vec![0_u8; FIRST_FRAME_SIZE],
&enc,
&[0x0, 0x7f, 0xff],
&[0_u8; 16383],
Expand All @@ -2062,6 +2076,7 @@ mod tests {
// Send 2 frames. For the second one we can only send 16383 bytes.
// After the first frame there is exactly 16383+4 bytes left in the send buffer, but we can only send 16383 bytes.
#[test]
#[allow(clippy::useless_vec)]
fn fetch_two_data_frame_second_16383bytes_place_for_16387() {
const FIRST_FRAME_SIZE: usize = Connection::stream_send_buffer_size() - 16410;

Expand All @@ -2072,7 +2087,7 @@ mod tests {
data_frame.encode(&mut enc);

fetch_with_two_data_frames(
&[0_u8; FIRST_FRAME_SIZE],
&vec![0_u8; FIRST_FRAME_SIZE],
&enc,
&[0x0, 0x7f, 0xff],
&[0_u8; 16383],
Expand All @@ -2082,6 +2097,7 @@ mod tests {
// Send 2 frames. For the second one we can only send 16383 bytes.
// After the first frame there is exactly 16383+5 bytes left in the send buffer, but we can only send 16383 bytes.
#[test]
#[allow(clippy::useless_vec)]
fn fetch_two_data_frame_second_16383bytes_place_for_16388() {
const FIRST_FRAME_SIZE: usize = Connection::stream_send_buffer_size() - 16411;

Expand All @@ -2092,7 +2108,7 @@ mod tests {
data_frame.encode(&mut enc);

fetch_with_two_data_frames(
&[0_u8; FIRST_FRAME_SIZE],
&vec![0_u8; FIRST_FRAME_SIZE],
&enc,
&[0x0, 0x7f, 0xff],
&[0_u8; 16383],
Expand All @@ -2102,6 +2118,7 @@ mod tests {
// Send 2 frames. For the second one we can send 16384 bytes.
// After the first frame there is exactly 16384+5 bytes left in the send buffer, but we can send 16384 bytes.
#[test]
#[allow(clippy::useless_vec)]
fn fetch_two_data_frame_second_16384bytes_place_for_16389() {
const FIRST_FRAME_SIZE: usize = Connection::stream_send_buffer_size() - 16412;

Expand All @@ -2112,7 +2129,7 @@ mod tests {
data_frame.encode(&mut enc);

fetch_with_two_data_frames(
&[0_u8; FIRST_FRAME_SIZE],
&vec![0_u8; FIRST_FRAME_SIZE],
&enc,
&[0x0, 0x80, 0x0, 0x40, 0x0],
&[0_u8; 16384],
Expand Down

0 comments on commit 6fbbe53

Please sign in to comment.