Replace .map_or(false with Option::is_some_and (#33468)

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
This commit is contained in:
Simon Wülker 2024-09-16 12:03:52 +02:00 committed by GitHub
parent 236cae9ce5
commit 7df30f3788
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
51 changed files with 165 additions and 171 deletions

View file

@ -802,7 +802,7 @@ pub async fn http_fetch(
.actual_response()
.status
.as_ref()
.map_or(false, is_redirect_status)
.is_some_and(is_redirect_status)
{
// Substep 1.
if response
@ -992,7 +992,7 @@ pub async fn http_redirect_fetch(
.status
.as_ref()
.map_or(true, |s| s.0 != StatusCode::SEE_OTHER) &&
request.body.as_ref().map_or(false, |b| b.source_is_null())
request.body.as_ref().is_some_and(|b| b.source_is_null())
{
return Response::network_error(NetworkError::Internal("Request body is not done".into()));
}
@ -1007,7 +1007,7 @@ pub async fn http_redirect_fetch(
.actual_response()
.status
.as_ref()
.map_or(false, |(code, _)| {
.is_some_and(|(code, _)| {
((*code == StatusCode::MOVED_PERMANENTLY || *code == StatusCode::FOUND) &&
request.method == Method::POST) ||
(*code == StatusCode::SEE_OTHER &&
@ -1450,7 +1450,7 @@ async fn http_network_or_cache_fetch(
forward_response
.status
.as_ref()
.map_or(false, |s| s.0 == StatusCode::NOT_MODIFIED)
.is_some_and(|s| s.0 == StatusCode::NOT_MODIFIED)
{
if let Ok(mut http_cache) = context.state.http_cache.write() {
// Ensure done_chan is None,
@ -1989,7 +1989,7 @@ async fn cors_preflight_fetch(
response
.status
.as_ref()
.map_or(false, |(status, _)| status.is_success())
.is_some_and(|(status, _)| status.is_success())
{
// Substep 1
let mut methods = if response