From 5438a5cd2234f544b0c2ea3db0e4f1242ecf422a Mon Sep 17 00:00:00 2001 From: Fabian-Lars Date: Sun, 9 Nov 2025 18:43:17 +0100 Subject: [PATCH] chore: apply clippy fixes (#3092) --- plugins/dialog/src/models.rs | 9 ++------- plugins/opener/build.rs | 8 ++------ plugins/opener/src/reveal_item_in_dir.rs | 2 +- plugins/opener/src/scope_entry.rs | 8 ++------ plugins/shell/src/config.rs | 8 ++------ plugins/updater/src/config.rs | 8 ++------ 6 files changed, 11 insertions(+), 32 deletions(-) diff --git a/plugins/dialog/src/models.rs b/plugins/dialog/src/models.rs index 0b2de2c9a..330388f8e 100644 --- a/plugins/dialog/src/models.rs +++ b/plugins/dialog/src/models.rs @@ -6,9 +6,10 @@ use serde::{Deserialize, Deserializer, Serialize, Serializer}; /// Types of message, ask and confirm dialogs. #[non_exhaustive] -#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] +#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, Default)] pub enum MessageDialogKind { /// Information dialog. + #[default] Info, /// Warning dialog. Warning, @@ -16,12 +17,6 @@ pub enum MessageDialogKind { Error, } -impl Default for MessageDialogKind { - fn default() -> Self { - Self::Info - } -} - impl<'de> Deserialize<'de> for MessageDialogKind { fn deserialize(deserializer: D) -> Result where diff --git a/plugins/opener/build.rs b/plugins/opener/build.rs index fbad4d3ac..676903578 100644 --- a/plugins/opener/build.rs +++ b/plugins/opener/build.rs @@ -12,8 +12,10 @@ mod scope; #[derive(schemars::JsonSchema)] #[serde(untagged)] #[allow(unused)] +#[derive(Default)] enum Application { /// Open in default application. + #[default] Default, /// If true, allow open with any application. Enable(bool), @@ -21,12 +23,6 @@ enum Application { App(String), } -impl Default for Application { - fn default() -> Self { - Self::Default - } -} - /// Opener scope entry. #[derive(schemars::JsonSchema)] #[serde(untagged)] diff --git a/plugins/opener/src/reveal_item_in_dir.rs b/plugins/opener/src/reveal_item_in_dir.rs index 6112fb8b1..18f940c80 100644 --- a/plugins/opener/src/reveal_item_in_dir.rs +++ b/plugins/opener/src/reveal_item_in_dir.rs @@ -115,7 +115,7 @@ mod imp { let parent_item_id_list = OwnedItemIdList::new(parent)?; let to_reveals_item_id_list = to_reveals .iter() - .map(|to_reveal| OwnedItemIdList::new(*to_reveal)) + .map(|to_reveal| OwnedItemIdList::new(to_reveal)) .collect::>>()?; if let Err(e) = unsafe { SHOpenFolderAndSelectItems( diff --git a/plugins/opener/src/scope_entry.rs b/plugins/opener/src/scope_entry.rs index cf9004a2b..d4867b45b 100644 --- a/plugins/opener/src/scope_entry.rs +++ b/plugins/opener/src/scope_entry.rs @@ -8,18 +8,14 @@ use serde::Deserialize; #[derive(Deserialize, Debug)] #[serde(untagged)] +#[derive(Default)] pub enum Application { + #[default] Default, Enable(bool), App(String), } -impl Default for Application { - fn default() -> Self { - Self::Default - } -} - #[derive(Deserialize)] #[serde(untagged, rename_all = "camelCase")] pub(crate) enum EntryRaw { diff --git a/plugins/shell/src/config.rs b/plugins/shell/src/config.rs index 69a92ee15..1523c0805 100644 --- a/plugins/shell/src/config.rs +++ b/plugins/shell/src/config.rs @@ -17,9 +17,11 @@ pub struct Config { #[derive(Debug, PartialEq, Eq, Clone, Deserialize)] #[serde(untagged, deny_unknown_fields)] #[non_exhaustive] +#[derive(Default)] pub enum ShellAllowlistOpen { /// Shell open API allowlist is not defined by the user. /// In this case we add the default validation regex (same as [`Self::Flag(true)`]). + #[default] Unset, /// If the shell open API should be enabled. /// @@ -35,9 +37,3 @@ pub enum ShellAllowlistOpen { /// that allow flag-like strings to pass validation. e.g. `--enable-debugging`, `-i`, `/R`. Validate(String), } - -impl Default for ShellAllowlistOpen { - fn default() -> Self { - Self::Unset - } -} diff --git a/plugins/updater/src/config.rs b/plugins/updater/src/config.rs index 6b16bc01f..05dda11f7 100644 --- a/plugins/updater/src/config.rs +++ b/plugins/updater/src/config.rs @@ -10,6 +10,7 @@ use url::Url; /// Install modes for the Windows update. #[derive(Debug, PartialEq, Eq, Clone, Deserialize)] #[serde(rename_all = "camelCase")] +#[derive(Default)] pub enum WindowsUpdateInstallMode { /// Specifies there's a basic UI during the installation process, including a final dialog box at the end. BasicUi, @@ -17,6 +18,7 @@ pub enum WindowsUpdateInstallMode { /// Requires admin privileges if the installer does. Quiet, /// Specifies unattended mode, which means the installation only shows a progress bar. + #[default] Passive, } @@ -57,12 +59,6 @@ impl Display for WindowsUpdateInstallMode { } } -impl Default for WindowsUpdateInstallMode { - fn default() -> Self { - Self::Passive - } -} - #[derive(Debug, Clone, Deserialize, Default)] #[serde(rename_all = "camelCase")] pub struct WindowsConfig {