From 6c21f2ef4b87eb4e291f81a66413aad1b0a5f081 Mon Sep 17 00:00:00 2001 From: Valentin Tolmer Date: Tue, 27 Sep 2022 06:48:39 +0200 Subject: [PATCH] clippy: fix warning by implementing Eq --- app/src/components/change_password.rs | 4 ++-- app/src/components/create_group.rs | 2 +- app/src/components/create_user.rs | 2 +- app/src/components/group_details.rs | 2 +- app/src/components/group_table.rs | 2 +- app/src/components/login.rs | 2 +- app/src/components/reset_password_step1.rs | 2 +- app/src/components/reset_password_step2.rs | 4 ++-- app/src/components/select.rs | 2 +- app/src/components/user_details.rs | 2 +- app/src/components/user_details_form.rs | 8 ++++---- server/src/domain/handler.rs | 2 +- server/src/infra/auth_service.rs | 4 ++-- 13 files changed, 19 insertions(+), 19 deletions(-) diff --git a/app/src/components/change_password.rs b/app/src/components/change_password.rs index 3026984..ef22710 100644 --- a/app/src/components/change_password.rs +++ b/app/src/components/change_password.rs @@ -36,7 +36,7 @@ impl OpaqueData { } /// The fields of the form, with the constraints. -#[derive(Model, Validate, PartialEq, Clone, Default)] +#[derive(Model, Validate, PartialEq, Eq, Clone, Default)] pub struct FormModel { #[validate(custom( function = "empty_or_long", @@ -64,7 +64,7 @@ pub struct ChangePasswordForm { route_dispatcher: RouteAgentDispatcher, } -#[derive(Clone, PartialEq, Properties)] +#[derive(Clone, PartialEq, Eq, Properties)] pub struct Props { pub username: String, pub is_admin: bool, diff --git a/app/src/components/create_group.rs b/app/src/components/create_group.rs index 37cd504..7611d2b 100644 --- a/app/src/components/create_group.rs +++ b/app/src/components/create_group.rs @@ -28,7 +28,7 @@ pub struct CreateGroupForm { form: yew_form::Form, } -#[derive(Model, Validate, PartialEq, Clone, Default)] +#[derive(Model, Validate, PartialEq, Eq, Clone, Default)] pub struct CreateGroupModel { #[validate(length(min = 1, message = "Groupname is required"))] groupname: String, diff --git a/app/src/components/create_user.rs b/app/src/components/create_user.rs index dc146e2..4a6911c 100644 --- a/app/src/components/create_user.rs +++ b/app/src/components/create_user.rs @@ -32,7 +32,7 @@ pub struct CreateUserForm { form: yew_form::Form, } -#[derive(Model, Validate, PartialEq, Clone, Default)] +#[derive(Model, Validate, PartialEq, Eq, Clone, Default)] pub struct CreateUserModel { #[validate(length(min = 1, message = "Username is required"))] username: String, diff --git a/app/src/components/group_details.rs b/app/src/components/group_details.rs index 33bbd6f..c3714e8 100644 --- a/app/src/components/group_details.rs +++ b/app/src/components/group_details.rs @@ -40,7 +40,7 @@ pub enum Msg { OnUserRemovedFromGroup((String, i64)), } -#[derive(yew::Properties, Clone, PartialEq)] +#[derive(yew::Properties, Clone, PartialEq, Eq)] pub struct Props { pub group_id: i64, } diff --git a/app/src/components/group_table.rs b/app/src/components/group_table.rs index 206c084..0cfdc24 100644 --- a/app/src/components/group_table.rs +++ b/app/src/components/group_table.rs @@ -13,7 +13,7 @@ use yew::prelude::*; #[graphql( schema_path = "../schema.graphql", query_path = "queries/get_group_list.graphql", - response_derives = "Debug,Clone,PartialEq", + response_derives = "Debug,Clone,PartialEq,Eq", custom_scalars_module = "crate::infra::graphql" )] pub struct GetGroupList; diff --git a/app/src/components/login.rs b/app/src/components/login.rs index 3c8f44e..70218a1 100644 --- a/app/src/components/login.rs +++ b/app/src/components/login.rs @@ -19,7 +19,7 @@ pub struct LoginForm { } /// The fields of the form, with the constraints. -#[derive(Model, Validate, PartialEq, Clone, Default)] +#[derive(Model, Validate, PartialEq, Eq, Clone, Default)] pub struct FormModel { #[validate(length(min = 1, message = "Missing username"))] username: String, diff --git a/app/src/components/reset_password_step1.rs b/app/src/components/reset_password_step1.rs index 2309a11..b23ef49 100644 --- a/app/src/components/reset_password_step1.rs +++ b/app/src/components/reset_password_step1.rs @@ -18,7 +18,7 @@ pub struct ResetPasswordStep1Form { } /// The fields of the form, with the constraints. -#[derive(Model, Validate, PartialEq, Clone, Default)] +#[derive(Model, Validate, PartialEq, Eq, Clone, Default)] pub struct FormModel { #[validate(length(min = 1, message = "Missing username"))] username: String, diff --git a/app/src/components/reset_password_step2.rs b/app/src/components/reset_password_step2.rs index 5fe8e00..a14b36b 100644 --- a/app/src/components/reset_password_step2.rs +++ b/app/src/components/reset_password_step2.rs @@ -20,7 +20,7 @@ use yew_router::{ }; /// The fields of the form, with the constraints. -#[derive(Model, Validate, PartialEq, Clone, Default)] +#[derive(Model, Validate, PartialEq, Eq, Clone, Default)] pub struct FormModel { #[validate(length(min = 8, message = "Invalid password. Min length: 8"))] password: String, @@ -36,7 +36,7 @@ pub struct ResetPasswordStep2Form { route_dispatcher: RouteAgentDispatcher, } -#[derive(Clone, PartialEq, Properties)] +#[derive(Clone, PartialEq, Eq, Properties)] pub struct Props { pub token: String, } diff --git a/app/src/components/select.rs b/app/src/components/select.rs index 1125b2b..cdeaaf2 100644 --- a/app/src/components/select.rs +++ b/app/src/components/select.rs @@ -81,7 +81,7 @@ pub struct SelectOption { props: SelectOptionProps, } -#[derive(yew::Properties, Clone, PartialEq, Debug)] +#[derive(yew::Properties, Clone, PartialEq, Eq, Debug)] pub struct SelectOptionProps { pub value: String, pub text: String, diff --git a/app/src/components/user_details.rs b/app/src/components/user_details.rs index 67ab078..1609e4e 100644 --- a/app/src/components/user_details.rs +++ b/app/src/components/user_details.rs @@ -40,7 +40,7 @@ pub enum Msg { OnUserRemovedFromGroup((String, i64)), } -#[derive(yew::Properties, Clone, PartialEq)] +#[derive(yew::Properties, Clone, PartialEq, Eq)] pub struct Props { pub username: String, pub is_admin: bool, diff --git a/app/src/components/user_details_form.rs b/app/src/components/user_details_form.rs index 013c907..2db24a1 100644 --- a/app/src/components/user_details_form.rs +++ b/app/src/components/user_details_form.rs @@ -11,7 +11,7 @@ use wasm_bindgen::JsCast; use yew::{prelude::*, services::ConsoleService}; use yew_form_derive::Model; -#[derive(PartialEq, Clone, Default)] +#[derive(PartialEq, Eq, Clone, Default)] struct JsFile { file: Option, contents: Option>, @@ -39,7 +39,7 @@ impl FromStr for JsFile { } /// The fields of the form, with the editable details and the constraints. -#[derive(Model, Validate, PartialEq, Clone)] +#[derive(Model, Validate, PartialEq, Eq, Clone)] pub struct UserModel { #[validate(email)] email: String, @@ -55,7 +55,7 @@ pub struct UserModel { schema_path = "../schema.graphql", query_path = "queries/update_user.graphql", response_derives = "Debug", - variables_derives = "Clone,PartialEq", + variables_derives = "Clone,PartialEq,Eq", custom_scalars_module = "crate::infra::graphql" )] pub struct UpdateUser; @@ -80,7 +80,7 @@ pub enum Msg { UserUpdated(Result), } -#[derive(yew::Properties, Clone, PartialEq)] +#[derive(yew::Properties, Clone, PartialEq, Eq)] pub struct Props { /// The current user details. pub user: User, diff --git a/server/src/domain/handler.rs b/server/src/domain/handler.rs index 65f07fa..4f7b902 100644 --- a/server/src/domain/handler.rs +++ b/server/src/domain/handler.rs @@ -265,7 +265,7 @@ pub struct GroupDetails { pub uuid: Uuid, } -#[derive(Debug, Clone, PartialEq)] +#[derive(Debug, Clone, PartialEq, Eq)] pub struct UserAndGroups { pub user: User, pub groups: Option>, diff --git a/server/src/infra/auth_service.rs b/server/src/infra/auth_service.rs index a732215..344d2ef 100644 --- a/server/src/infra/auth_service.rs +++ b/server/src/infra/auth_service.rs @@ -562,7 +562,7 @@ where } } -#[derive(Clone, Copy, PartialEq, Debug)] +#[derive(Clone, Copy, PartialEq, Eq, Debug)] pub enum Permission { Admin, PasswordManager, @@ -570,7 +570,7 @@ pub enum Permission { Regular, } -#[derive(Debug, Clone, PartialEq)] +#[derive(Debug, Clone, PartialEq, Eq)] pub struct ValidationResults { pub user: UserId, pub permission: Permission,