diff --git a/crates/db_schema/src/impls/oauth_provider.rs b/crates/db_schema/src/impls/oauth_provider.rs index 9d7e791e7..7665ba050 100644 --- a/crates/db_schema/src/impls/oauth_provider.rs +++ b/crates/db_schema/src/impls/oauth_provider.rs @@ -55,13 +55,11 @@ impl OAuthProvider { pub fn convert_providers_to_public( oauth_providers: Vec, ) -> Vec { - let mut result = Vec::::new(); - for oauth_provider in &oauth_providers { - if oauth_provider.enabled { - result.push(PublicOAuthProvider(oauth_provider.clone())); - } - } - result + oauth_providers + .into_iter() + .filter(|x| x.enabled) + .map(PublicOAuthProvider) + .collect() } pub async fn get_all_public(pool: &mut DbPool<'_>) -> Result, Error> {