Skip to content

Commit 555e140

Browse files
tottotoseanmonstar
authored andcommitted
refactor(proto): replace map and unwrap_or combination with map_or
1 parent c78379e commit 555e140

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

src/proto/h1/conn.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -276,8 +276,7 @@ where
276276
.head
277277
.headers
278278
.get(TE)
279-
.map(|te_header| te_header == "trailers")
280-
.unwrap_or(false);
279+
.map_or(false, |te_header| te_header == "trailers");
281280

282281
Poll::Ready(Some(Ok((msg.head, msg.decode, wants))))
283282
}
@@ -594,8 +593,7 @@ where
594593
let outgoing_is_keep_alive = head
595594
.headers
596595
.get(CONNECTION)
597-
.map(connection_keep_alive)
598-
.unwrap_or(false);
596+
.map_or(false, connection_keep_alive);
599597

600598
if !outgoing_is_keep_alive {
601599
match head.version {

src/proto/h2/mod.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,7 @@ fn strip_connection_headers(headers: &mut HeaderMap, is_request: bool) {
5454
if is_request {
5555
if headers
5656
.get(TE)
57-
.map(|te_header| te_header != "trailers")
58-
.unwrap_or(false)
57+
.map_or(false, |te_header| te_header != "trailers")
5958
{
6059
warn!("TE headers not set to \"trailers\" are illegal in HTTP/2 requests");
6160
headers.remove(TE);

0 commit comments

Comments
 (0)