Skip to content

Commit

Permalink
Fix Clippy warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomasdezeeuw committed May 19, 2021
1 parent be251cf commit a48630c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
3 changes: 2 additions & 1 deletion http/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
generic_associated_types,
io_slice_advance,
maybe_uninit_write_slice,
ready_macro
ready_macro,
stmt_expr_attributes
)]
#![allow(incomplete_features)] // NOTE: for `generic_associated_types`.

Expand Down
16 changes: 8 additions & 8 deletions http/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,7 @@ impl Connection {
/// Also see the [`Connection::last_request_version`] and
/// [`Connection::last_request_method`] functions to properly respond to
/// request errors.
#[allow(clippy::too_many_lines)] // TODO.
pub async fn next_request<'a>(
&'a mut self,
) -> io::Result<Result<Option<Request<Body<'a>>>, RequestError>> {
Expand Down Expand Up @@ -555,15 +556,15 @@ impl Connection {
let kind = match body_length {
Some(BodyLength::Known(left)) => BodyKind::Oneshot { left },
Some(BodyLength::Chunked) => {
#[allow(clippy::cast_possible_truncation)] // For truncate below.
match httparse::parse_chunk_size(&self.buf[self.parsed_bytes..]) {
Ok(httparse::Status::Complete((idx, chunk_size))) => {
self.parsed_bytes += idx;
let read_complete = if chunk_size == 0 { true } else { false };
BodyKind::Chunked {
// FIXME: add check here. It's fine on
// 64 bit (only currently supported).
left_in_chunk: chunk_size as usize,
read_complete,
read_complete: chunk_size == 0,
}
}
Ok(httparse::Status::Partial) => BodyKind::Chunked {
Expand Down Expand Up @@ -1039,6 +1040,7 @@ fn read_chunk(
loop {
ready!(conn.recv())?;
match httparse::parse_chunk_size(&conn.buf) {
#[allow(clippy::cast_possible_truncation)] // For truncate below.
Ok(httparse::Status::Complete((idx, chunk_size))) => {
conn.parsed_bytes += idx;
if chunk_size == 0 {
Expand Down Expand Up @@ -1101,10 +1103,9 @@ where
continue;
}
}
} else {
// Continue to reading below.
break;
}
// Continue to reading below.
break;
}

// Read from the stream if there is space left.
Expand Down Expand Up @@ -1177,10 +1178,9 @@ where
continue;
}
}
} else {
// Continue to reading below.
break;
}
// Continue to reading below.
break;
}

// Read from the stream if there is space left.
Expand Down

0 comments on commit a48630c

Please sign in to comment.