From 8b7852bf1ca35aeb89e933ce94ce9fb723e45c34 Mon Sep 17 00:00:00 2001 From: Valentin Tolmer Date: Sat, 13 Jan 2024 16:42:17 +0100 Subject: [PATCH] chore: clippy warnings --- server/src/domain/sql_migrations.rs | 2 ++ server/src/domain/types.rs | 2 +- server/tests/integrations.rs | 2 +- server/tests/ldap.rs | 2 +- 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/server/src/domain/sql_migrations.rs b/server/src/domain/sql_migrations.rs index 69d8e33..02f64b0 100644 --- a/server/src/domain/sql_migrations.rs +++ b/server/src/domain/sql_migrations.rs @@ -48,6 +48,7 @@ pub enum Memberships { GroupId, } +#[allow(clippy::enum_variant_names)] // The table names are generated from the enum. #[derive(DeriveIden, PartialEq, Eq, Debug, Serialize, Deserialize, Clone, Copy)] pub enum UserAttributeSchema { Table, @@ -67,6 +68,7 @@ pub enum UserAttributes { UserAttributeValue, } +#[allow(clippy::enum_variant_names)] // The table names are generated from the enum. #[derive(DeriveIden, PartialEq, Eq, Debug, Serialize, Deserialize, Clone, Copy)] pub enum GroupAttributeSchema { Table, diff --git a/server/src/domain/types.rs b/server/src/domain/types.rs index 8961cfe..a22e487 100644 --- a/server/src/domain/types.rs +++ b/server/src/domain/types.rs @@ -10,7 +10,7 @@ use sea_orm::{ use serde::{Deserialize, Serialize}; use strum::{EnumString, IntoStaticStr}; -pub use super::model::{GroupColumn, UserColumn}; +pub use super::model::UserColumn; #[derive(PartialEq, Hash, Eq, Clone, Debug, Default, Serialize, Deserialize, DeriveValueType)] #[serde(try_from = "&str")] diff --git a/server/tests/integrations.rs b/server/tests/integrations.rs index 88fc605..c5fe524 100644 --- a/server/tests/integrations.rs +++ b/server/tests/integrations.rs @@ -47,7 +47,7 @@ fn gitea() { let mut found_users: HashSet = HashSet::new(); for result in results { let attrs = SearchEntry::construct(result).attrs; - let user = attrs.get("uid").unwrap().get(0).unwrap(); + let user = attrs.get("uid").unwrap().first().unwrap(); found_users.insert(user.clone()); } assert!(found_users.contains(&gitea_user1)); diff --git a/server/tests/ldap.rs b/server/tests/ldap.rs index 0bca2c8..8ffac9f 100644 --- a/server/tests/ldap.rs +++ b/server/tests/ldap.rs @@ -102,7 +102,7 @@ fn get_users_and_groups(results: SearchResult) -> HashMap> = HashMap::new(); for result in results { let attrs = SearchEntry::construct(result).attrs; - let user = attrs.get("uid").unwrap().get(0).unwrap(); + let user = attrs.get("uid").unwrap().first().unwrap(); let user_groups = attrs.get("memberof").unwrap().clone(); let mut groups: HashSet = HashSet::new(); groups.extend(user_groups.clone());