From a8a7b16e9f2ee41c1303f385b3863b34d676ca87 Mon Sep 17 00:00:00 2001 From: Adrien Date: Sun, 27 Apr 2025 22:10:27 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=91=B7=20Add=20cargo=20sort-derives=20too?= =?UTF-8?q?l?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .woodpecker/.validate.yaml | 6 ++++++ src/domain/model/room.rs | 2 +- src/infrastructure/messaging/matrix/client.rs | 2 +- src/infrastructure/services/random_svg_generators.rs | 2 +- src/ui/components/button.rs | 6 +++--- src/ui/components/icons.rs | 4 ++-- src/ui/components/modal.rs | 4 ++-- src/ui/components/spinner.rs | 2 +- src/ui/components/text_input.rs | 4 ++-- 9 files changed, 19 insertions(+), 13 deletions(-) diff --git a/.woodpecker/.validate.yaml b/.woodpecker/.validate.yaml index d09f847..38233e5 100644 --- a/.woodpecker/.validate.yaml +++ b/.woodpecker/.validate.yaml @@ -5,6 +5,12 @@ steps: rustup component add rustfmt cargo fmt --all --check + - name: lint - sort derives + image: rust:1.86 + commands: | + cargo install --locked cargo-sort-derives + cargo sort-derives --check + - name: lint - clippy image: rust:1.86 commands: | diff --git a/src/domain/model/room.rs b/src/domain/model/room.rs index 91ce56a..28784b3 100644 --- a/src/domain/model/room.rs +++ b/src/domain/model/room.rs @@ -21,7 +21,7 @@ use crate::infrastructure::services::mozaik_builder::create_mozaik; pub type RoomId = OwnedRoomId; -#[derive(PartialEq, Clone)] +#[derive(Clone, PartialEq)] pub struct Invitation { invitee_id: UserId, sender_id: UserId, diff --git a/src/infrastructure/messaging/matrix/client.rs b/src/infrastructure/messaging/matrix/client.rs index a49a675..b50c2e2 100644 --- a/src/infrastructure/messaging/matrix/client.rs +++ b/src/infrastructure/messaging/matrix/client.rs @@ -43,7 +43,7 @@ use super::{ }; use crate::utils::oneshot; -#[derive(thiserror::Error, Debug)] +#[derive(Debug, thiserror::Error)] pub enum ClientError { #[error("Matrix client error: {0}")] Matrix(#[from] matrix_sdk::Error), diff --git a/src/infrastructure/services/random_svg_generators.rs b/src/infrastructure/services/random_svg_generators.rs index 2ca21e0..97e98d2 100644 --- a/src/infrastructure/services/random_svg_generators.rs +++ b/src/infrastructure/services/random_svg_generators.rs @@ -15,7 +15,7 @@ cfg_if! { } } -#[derive(Eq, PartialEq, Hash)] +#[derive(Eq, Hash, PartialEq)] pub enum AvatarFeeling { Ok, Warning, diff --git a/src/ui/components/button.rs b/src/ui/components/button.rs index d8fd046..5b586c6 100644 --- a/src/ui/components/button.rs +++ b/src/ui/components/button.rs @@ -3,7 +3,7 @@ use dioxus_free_icons::{Icon, IconShape}; turf::style_sheet!("src/ui/components/button.scss"); -#[derive(PartialEq, Clone, Props)] +#[derive(Clone, PartialEq, Props)] struct _ButtonProps { children: Element, #[props(default = false)] @@ -15,7 +15,7 @@ struct _ButtonProps { macro_rules! svg_text_icon { ($name:ident,$text:literal) => { - #[derive(Copy, Clone, PartialEq)] + #[derive(Clone, Copy, PartialEq)] struct $name; impl IconShape for $name { fn view_box(&self) -> &str { @@ -67,7 +67,7 @@ macro_rules! svg_text_button { }; } -#[derive(PartialEq, Clone, Props)] +#[derive(Clone, PartialEq, Props)] pub struct ButtonProps { #[props(default = false)] focus: bool, diff --git a/src/ui/components/icons.rs b/src/ui/components/icons.rs index 7516049..1a125bf 100644 --- a/src/ui/components/icons.rs +++ b/src/ui/components/icons.rs @@ -87,7 +87,7 @@ const _PYRAMID_VIEWBOX_HEIGHT: i64 = (_PYRAMID_CENTRAL_EDGE_E2_Y + _PYRAMID_STRO const _PYRAMID_VIEWBOX_WIDTH: i64 = (_PYRAMID_RIGHT_EDGE_E2_X + _PYRAMID_STROKE_WIDTH) as i64; const _PYRAMID_VIEWBOX: &str = formatcp!("0 0 {_PYRAMID_VIEWBOX_WIDTH} {_PYRAMID_VIEWBOX_HEIGHT}"); -#[derive(PartialEq, Clone)] +#[derive(Clone, PartialEq)] struct PyramidShape { color: String, ratio: f64, @@ -154,7 +154,7 @@ impl IconShape for PyramidShape { } } -#[derive(PartialEq, Clone, Props)] +#[derive(Clone, PartialEq, Props)] pub struct PyramidProps { color: Option, #[props(default = 0.5)] diff --git a/src/ui/components/modal.rs b/src/ui/components/modal.rs index f919c83..01c71b5 100644 --- a/src/ui/components/modal.rs +++ b/src/ui/components/modal.rs @@ -15,7 +15,7 @@ use style::{COLOR_CRITICAL_100, COLOR_SUCCESS_100, COLOR_WARNING_100}; turf::style_sheet!("src/ui/components/modal.scss"); -#[derive(Clone, Copy, Eq, PartialEq, Hash)] +#[derive(Clone, Copy, Eq, Hash, PartialEq)] pub enum Severity { Ok, Warning, @@ -42,7 +42,7 @@ fn avatar_configs() -> &'static HashMap> { }) } -#[derive(Props, Clone, PartialEq)] +#[derive(Clone, PartialEq, Props)] pub struct ModalProps { pub severity: Severity, #[props(optional)] diff --git a/src/ui/components/spinner.rs b/src/ui/components/spinner.rs index a45f2d9..9b8be93 100644 --- a/src/ui/components/spinner.rs +++ b/src/ui/components/spinner.rs @@ -5,7 +5,7 @@ use crate::ui::components::icons::LogoShape; turf::style_sheet!("src/ui/components/spinner.scss"); -#[derive(PartialEq, Clone, Props)] +#[derive(Clone, PartialEq, Props)] pub struct SpinnerProps { #[props(default = true)] animate: bool, diff --git a/src/ui/components/text_input.rs b/src/ui/components/text_input.rs index 8f34dd8..fc6ea75 100644 --- a/src/ui/components/text_input.rs +++ b/src/ui/components/text_input.rs @@ -9,7 +9,7 @@ turf::style_sheet!("src/ui/components/text_input.scss"); pub trait InputPropsData {} -#[derive(Props, Clone, PartialEq)] +#[derive(Clone, PartialEq, Props)] pub struct InputProps { value: Option, placeholder: Option, @@ -97,7 +97,7 @@ pub fn TextInput(props: InputProps) -> Element { } } -#[derive(Props, Clone, PartialEq)] +#[derive(Clone, PartialEq, Props)] pub struct PasswordInputState { text_input_state: TextInputState, #[props(default = 0.0)]