Skip to content

Commit

Permalink
Replace use of .map_or(false, _) with .is_some_and(_)
Browse files Browse the repository at this point in the history
As suggested by clippy
  • Loading branch information
ColinKinloch committed Jan 27, 2025
1 parent da52a31 commit dcb6731
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/retry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ const INITIAL_INTERVAL: Duration = Duration::from_millis(300);
fn is_client_error(err: &(dyn std::error::Error + 'static)) -> bool {
err.downcast_ref::<reqwest::Error>()
.and_then(|e| e.status())
.map_or(false, |status| status.is_client_error())
.is_some_and(|status| status.is_client_error())
|| err
.downcast_ref::<obs::Error>()
.map_or(false, |err| matches!(err, obs::Error::ApiError(_)))
.is_some_and(|err| matches!(err, obs::Error::ApiError(_)))
}

fn is_caused_by_client_error(report: &Report) -> bool {
Expand All @@ -26,8 +26,7 @@ fn is_caused_by_client_error(report: &Report) -> bool {
// source()), so we need to examine that error directly.
|| err
.downcast_ref::<std::io::Error>()
.and_then(|err| err.get_ref())
.map_or(false, |err| is_client_error(err))
.and_then(|err| err.get_ref()).is_some_and(|err| is_client_error(err))
})
}

Expand Down

0 comments on commit dcb6731

Please sign in to comment.