From 23abab0644dc9c17f0f9b321c289c61b65cea613 Mon Sep 17 00:00:00 2001 From: David Cook Date: Mon, 13 Jan 2025 09:40:00 -0600 Subject: [PATCH] Fix clippy lints --- src/api_mocks/aggregator_api.rs | 2 +- src/entity/task/new_task.rs | 2 +- src/user.rs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/api_mocks/aggregator_api.rs b/src/api_mocks/aggregator_api.rs index 0530415b..948c603f 100644 --- a/src/api_mocks/aggregator_api.rs +++ b/src/api_mocks/aggregator_api.rs @@ -55,7 +55,7 @@ async fn bearer_token_check(conn: Conn) -> Conn { let token_is_valid = conn .request_headers() .get_str(KnownHeaderName::Authorization) - .map_or(false, |s| match s.split_once(' ') { + .is_some_and(|s| match s.split_once(' ') { Some(("Bearer", BAD_BEARER_TOKEN)) => false, Some(("Bearer", _)) => true, _ => false, diff --git a/src/entity/task/new_task.rs b/src/entity/task/new_task.rs index ae2958de..ef5e7d94 100644 --- a/src/entity/task/new_task.rs +++ b/src/entity/task/new_task.rs @@ -146,7 +146,7 @@ impl NewTask { Some(collector_credential) => { let leader_needs_token_hash = - leader.map_or(false, |leader| leader.features.token_hash_enabled()); + leader.is_some_and(|leader| leader.features.token_hash_enabled()); if leader_needs_token_hash && collector_credential.token_hash.is_none() { errors.add( diff --git a/src/user.rs b/src/user.rs index 171af6b1..9613ee5e 100644 --- a/src/user.rs +++ b/src/user.rs @@ -55,7 +55,7 @@ impl User { .count(db) .await .ok() - .map_or(false, |n| n > 0) + .is_some_and(|n| n > 0) } async fn populate_admin(&mut self, db: &Db) {