From fda125de5f620a8fdf6334fa9cb13d6e94a01bac Mon Sep 17 00:00:00 2001 From: Evan Almloff Date: Sun, 12 Mar 2023 15:13:34 -0500 Subject: [PATCH] fix clippy --- packages/tui/src/config.rs | 9 ++------- packages/tui/src/focus.rs | 9 ++------- packages/tui/src/node.rs | 9 ++------- 3 files changed, 6 insertions(+), 21 deletions(-) diff --git a/packages/tui/src/config.rs b/packages/tui/src/config.rs index 8251b13b6..41e068542 100644 --- a/packages/tui/src/config.rs +++ b/packages/tui/src/config.rs @@ -46,18 +46,13 @@ impl Default for Config { } } -#[derive(Clone, Copy)] +#[derive(Clone, Copy, Default)] pub enum RenderingMode { /// only 16 colors by accessed by name, no alpha support BaseColors, /// 8 bit colors, will be downsampled from rgb colors Ansi, /// 24 bit colors, most terminals support this + #[default] Rgb, } - -impl Default for RenderingMode { - fn default() -> Self { - RenderingMode::Rgb - } -} diff --git a/packages/tui/src/focus.rs b/packages/tui/src/focus.rs index 57f1c9e1f..89245d9b9 100644 --- a/packages/tui/src/focus.rs +++ b/packages/tui/src/focus.rs @@ -14,8 +14,9 @@ use dioxus_native_core::{ state::NodeDepState, }; -#[derive(Clone, Copy, PartialEq, Eq, Debug)] +#[derive(Clone, Copy, PartialEq, Eq, Debug, Default)] pub(crate) enum FocusLevel { + #[default] Unfocusable, Focusable, Ordered(std::num::NonZeroU16), @@ -53,12 +54,6 @@ impl Ord for FocusLevel { } } -impl Default for FocusLevel { - fn default() -> Self { - FocusLevel::Unfocusable - } -} - #[derive(Clone, PartialEq, Debug, Default)] pub(crate) struct Focus { pub level: FocusLevel, diff --git a/packages/tui/src/node.rs b/packages/tui/src/node.rs index 26ea4412e..7ef7d9c9a 100644 --- a/packages/tui/src/node.rs +++ b/packages/tui/src/node.rs @@ -20,7 +20,7 @@ pub(crate) struct NodeState { pub focused: bool, } -#[derive(PartialEq, Debug, Clone)] +#[derive(PartialEq, Debug, Clone, Default)] pub(crate) enum PreventDefault { Focus, KeyPress, @@ -32,6 +32,7 @@ pub(crate) enum PreventDefault { MouseEnter, MouseLeave, MouseOut, + #[default] Unknown, MouseOver, ContextMenu, @@ -39,12 +40,6 @@ pub(crate) enum PreventDefault { MouseUp, } -impl Default for PreventDefault { - fn default() -> Self { - PreventDefault::Unknown - } -} - impl NodeDepState for PreventDefault { type DepState = (); type Ctx = ();