Skip to content

Commit a52ac4e

Browse files
committed
ref: cargo fmt
1 parent 5a88acf commit a52ac4e

3 files changed

Lines changed: 6 additions & 11 deletions

File tree

adapter/rest/src/config.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
use base::traits::LoadConfig;
22
use code0_flow::flow_config::env_with_default;
33

4-
54
#[derive(Clone)]
65
pub struct HttpServerConfig {
76
pub port: u16,

adapter/rest/src/main.rs

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,7 @@ async fn execute_flow_to_hyper_response(
9292
body: Vec<u8>,
9393
store: Arc<base::store::AdapterStore>,
9494
) -> Response<Full<Bytes>> {
95-
let value: Option<Value> = match prost::Message::decode(body.as_slice()) {
96-
Ok(v) => Some(v),
97-
Err(_) => None,
98-
};
95+
let value: Option<Value> = prost::Message::decode(body.as_slice()).ok();
9996

10097
match store.validate_and_execute_flow(flow, value).await {
10198
Some(result) => {
@@ -150,9 +147,9 @@ async fn execute_flow_to_hyper_response(
150147
kind: Some(StructValue(Struct { fields: f })),
151148
} = x
152149
{
153-
return Some(f);
150+
Some(f)
154151
} else {
155-
return None;
152+
None
156153
}
157154
})
158155
.filter_map(|f| {
@@ -183,8 +180,7 @@ async fn execute_flow_to_hyper_response(
183180
None => return None,
184181
};
185182

186-
187-
return Some((key.clone(), value.clone()));
183+
Some((key.clone(), value.clone()))
188184
})
189185
.collect();
190186

@@ -207,7 +203,7 @@ async fn execute_flow_to_hyper_response(
207203
}
208204
None => {
209205
log::error!("flow execution failed");
210-
return json_error(StatusCode::INTERNAL_SERVER_ERROR, "Flow execution failed");
206+
json_error(StatusCode::INTERNAL_SERVER_ERROR, "Flow execution failed")
211207
}
212208
}
213209
}

adapter/rest/src/route.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ impl IdentifiableFlow for RequestRoute {
6969
match regex::Regex::new(regex_str) {
7070
Ok(regex) => {
7171
log::debug!("found a match for {}", regex_str);
72-
return regex.is_match(&self.url);
72+
regex.is_match(&self.url)
7373
}
7474
Err(err) => {
7575
log::error!("Failed to compile regex: {}", err);

0 commit comments

Comments
 (0)