From d35c2771a6b56c64e3c69375e6a62faa699e2f9e Mon Sep 17 00:00:00 2001 From: Victor Mignot Date: Wed, 1 Jan 2025 15:14:14 +0100 Subject: [PATCH] Fix clippy lints error --- src/discord/commands/create_tag.rs | 2 +- src/discord/commands/delete_tag.rs | 2 +- src/discord/message_builders/selector_builder.rs | 5 +---- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/discord/commands/create_tag.rs b/src/discord/commands/create_tag.rs index 3e1d15c..b454fd1 100644 --- a/src/discord/commands/create_tag.rs +++ b/src/discord/commands/create_tag.rs @@ -56,7 +56,7 @@ impl BotCommand for CreateTagCommand { database: Arc, ) -> Result<(), CommandExecutionError> { // Extract tag_name parameter - let tag_name = match self.interaction.data.options.get(0) { + let tag_name = match self.interaction.data.options.first() { Some(a) => match &a.resolved { Some(r) => match r { CommandDataOptionValue::String(r_str) => Ok(r_str), diff --git a/src/discord/commands/delete_tag.rs b/src/discord/commands/delete_tag.rs index be74257..bb9dab2 100644 --- a/src/discord/commands/delete_tag.rs +++ b/src/discord/commands/delete_tag.rs @@ -55,7 +55,7 @@ impl BotCommand for DeleteTagCommand { context: Context, database: Arc, ) -> Result<(), CommandExecutionError> { - let tag_name = match self.interaction.data.options.get(0) { + let tag_name = match self.interaction.data.options.first() { Some(a) => match &a.resolved { Some(r) => match r { CommandDataOptionValue::String(r_str) => Ok(r_str), diff --git a/src/discord/message_builders/selector_builder.rs b/src/discord/message_builders/selector_builder.rs index 2f0e4b3..3d804ca 100644 --- a/src/discord/message_builders/selector_builder.rs +++ b/src/discord/message_builders/selector_builder.rs @@ -64,10 +64,7 @@ impl<'a> EmbedSelector<'a> { selectable: Vec, initial_selection: Option>, ) -> Self { - let selection = match initial_selection { - Some(r) => r, - None => HashSet::new(), - }; + let selection = initial_selection.unwrap_or_default(); let mut selector = EmbedSelector { interaction,