Skip to content

Commit

Permalink
address clippy::map_unwrap_or (#1563)
Browse files Browse the repository at this point in the history
  • Loading branch information
demoray authored Jan 10, 2024
1 parent aab1d5e commit 8de1c73
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions sdk/core/src/policies/retry_policies/retry_policy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,9 @@ pub trait RetryPolicy: std::fmt::Debug + Send + Sync {
async fn wait(&self, _error: &Error, retry_count: u32, retry_after: Option<Duration>) {
let policy_sleep_duration = self.sleep_duration(retry_count);
// If the server provided a retry-after header, use the max of that and the policy sleep duration
let sleep_duration = retry_after
.map(|retry_after| std::cmp::max(retry_after, policy_sleep_duration))
.unwrap_or(policy_sleep_duration);
let sleep_duration = retry_after.map_or(policy_sleep_duration, |retry_after| {
std::cmp::max(retry_after, policy_sleep_duration)
});
sleep(sleep_duration).await;
}
}
Expand Down

0 comments on commit 8de1c73

Please sign in to comment.