Skip to content

Commit 5dbba1d

Browse files
Switch to then_some
1 parent beeb08c commit 5dbba1d

File tree

1 file changed

+14
-22
lines changed

1 file changed

+14
-22
lines changed

apollo-router/src/plugins/connectors/make_requests.rs

Lines changed: 14 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -116,17 +116,13 @@ impl RequestInputs {
116116
.unwrap_or_default()
117117
.iter()
118118
.filter_map(|(key, value)| {
119-
if headers_used.contains(key.as_str()) {
120-
return Some((
121-
key.as_str().into(),
122-
value
123-
.iter()
124-
.map(|s| Value::String(s.as_str().into()))
125-
.collect(),
126-
));
127-
}
128-
129-
None
119+
headers_used.contains(key.as_str()).then_some((
120+
key.as_str().into(),
121+
value
122+
.iter()
123+
.map(|s| Value::String(s.as_str().into()))
124+
.collect(),
125+
))
130126
})
131127
.collect();
132128
let request_object = json!({
@@ -144,17 +140,13 @@ impl RequestInputs {
144140
.unwrap_or_default()
145141
.iter()
146142
.filter_map(|(key, value)| {
147-
if headers_used.contains(key.as_str()) {
148-
return Some((
149-
key.as_str().into(),
150-
value
151-
.iter()
152-
.map(|s| Value::String(s.as_str().into()))
153-
.collect(),
154-
));
155-
}
156-
157-
None
143+
headers_used.contains(key.as_str()).then_some((
144+
key.as_str().into(),
145+
value
146+
.iter()
147+
.map(|s| Value::String(s.as_str().into()))
148+
.collect(),
149+
))
158150
})
159151
.collect();
160152
let response_object = json!({

0 commit comments

Comments
 (0)