Skip to content

Commit 0c0a2c2

Browse files
committed
ref: cargo clippy
1 parent 46ec14e commit 0c0a2c2

2 files changed

Lines changed: 5 additions & 12 deletions

File tree

adapter/rest/src/content_type.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,10 @@ pub fn parse_body(
7474
BodyFormat::TextPlain => parse_text_body(body),
7575
BodyFormat::Unknown => {
7676
// If there is no content type
77-
if content_type.is_none() {
78-
if let Ok(value) = parse_text_body(body) {
77+
if content_type.is_none()
78+
&& let Ok(value) = parse_text_body(body) {
7979
return Ok(value);
8080
}
81-
}
8281

8382
Err(BodyParseError::UnsupportedContentType {
8483
observed: content_type.unwrap_or("<missing>").to_string(),

adapter/rest/src/main.rs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ use hyper::{
1111
body::{Bytes, Incoming},
1212
};
1313
use hyper_util::rt::TokioIo;
14-
use serde_json::json;
1514
use std::convert::Infallible;
1615
use std::net::SocketAddr;
1716
use std::sync::Arc;
@@ -90,8 +89,7 @@ async fn execute_flow_to_hyper_response(
9089
fields: result_fields,
9190
})),
9291
} = &result
93-
{
94-
if result_fields.contains_key("name")
92+
&& result_fields.contains_key("name")
9593
&& result_fields.contains_key("message")
9694
&& !result_fields.contains_key("payload")
9795
&& !result_fields.contains_key("headers")
@@ -105,7 +103,6 @@ async fn execute_flow_to_hyper_response(
105103
format!("{}: {}", name.unwrap(), message.unwrap()).as_str(),
106104
);
107105
}
108-
}
109106

110107
value_to_http_response(result)
111108
}
@@ -180,11 +177,8 @@ pub async fn handle_request(
180177
header_fields.insert(key, value_str.to_value());
181178
}
182179

183-
match request_body_value {
184-
Some(v) => {
185-
fields.insert(String::from("payload"), v);
186-
}
187-
None => {}
180+
if let Some(v) = request_body_value {
181+
fields.insert(String::from("payload"), v);
188182
};
189183

190184
fields.insert(

0 commit comments

Comments
 (0)