Skip to content

Commit

Permalink
refactor(proto): replace map and unwrap_or combination with map_or
Browse files Browse the repository at this point in the history
  • Loading branch information
tottoto authored and seanmonstar committed Apr 17, 2024
1 parent c78379e commit 555e140
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
6 changes: 2 additions & 4 deletions src/proto/h1/conn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -276,8 +276,7 @@ where
.head
.headers
.get(TE)
.map(|te_header| te_header == "trailers")
.unwrap_or(false);
.map_or(false, |te_header| te_header == "trailers");

Poll::Ready(Some(Ok((msg.head, msg.decode, wants))))
}
Expand Down Expand Up @@ -594,8 +593,7 @@ where
let outgoing_is_keep_alive = head
.headers
.get(CONNECTION)
.map(connection_keep_alive)
.unwrap_or(false);
.map_or(false, connection_keep_alive);

if !outgoing_is_keep_alive {
match head.version {
Expand Down
3 changes: 1 addition & 2 deletions src/proto/h2/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,7 @@ fn strip_connection_headers(headers: &mut HeaderMap, is_request: bool) {
if is_request {
if headers
.get(TE)
.map(|te_header| te_header != "trailers")
.unwrap_or(false)
.map_or(false, |te_header| te_header != "trailers")
{
warn!("TE headers not set to \"trailers\" are illegal in HTTP/2 requests");
headers.remove(TE);
Expand Down

1 comment on commit 555e140

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Performance Alert ⚠️

Possible performance regression was detected for benchmark 'end_to_end'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 2.

Benchmark suite Current: 555e140 Previous: c78379e Ratio
http2_parallel_x10_req_10kb_100_chunks_adaptive_window 43201160 ns/iter (± 10397437) 16811657 ns/iter (± 18408968) 2.57

This comment was automatically generated by workflow using github-action-benchmark.

Please sign in to comment.