Skip to content

Commit

Permalink
chore: Use tidier Option unwrapping
Browse files Browse the repository at this point in the history
  • Loading branch information
stevensdavid committed Jul 4, 2024
1 parent cf6a4e1 commit ef89b57
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions src/probe/http_probe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,12 @@ pub async fn call_endpoint(
get_otel_headers(format!("{} {}", http_method, url));

let request = build_request(http_method, url, input_parameters, otel_headers)?;
let request_timeout = Duration::from_secs(input_parameters.as_ref().map_or(
DEFAULT_REQUEST_TIMEOUT_SECS,
|params| {
params
.timeout_seconds
.unwrap_or(DEFAULT_REQUEST_TIMEOUT_SECS)
},
));
let request_timeout = Duration::from_secs(
input_parameters
.as_ref()
.and_then(|params| params.timeout_seconds)
.unwrap_or(DEFAULT_REQUEST_TIMEOUT_SECS),
);
let response = request
.timeout(request_timeout)
.send()
Expand Down

0 comments on commit ef89b57

Please sign in to comment.