From 5ed41e9ced7ab406271678e0d1892df643f5eb8d Mon Sep 17 00:00:00 2001 From: GnomedDev Date: Tue, 16 Jan 2024 18:44:03 +0000 Subject: [PATCH] Format and fix clippy warning --- examples/feature_showcase/main.rs | 10 ++++++---- src/dispatch/prefix.rs | 18 ++++++++---------- src/prefix_argument/code_block.rs | 2 +- src/structs/framework_error.rs | 6 +++++- 4 files changed, 20 insertions(+), 16 deletions(-) diff --git a/examples/feature_showcase/main.rs b/examples/feature_showcase/main.rs index 44aa5a964a30..470c3a545041 100644 --- a/examples/feature_showcase/main.rs +++ b/examples/feature_showcase/main.rs @@ -77,10 +77,12 @@ async fn main() { ], prefix_options: poise::PrefixFrameworkOptions { prefix: Some("~".into()), - non_command_message: Some(|_, _, msg| Box::pin(async move { - println!("non command message!: {}", msg.content); - Ok(()) - })), + non_command_message: Some(|_, _, msg| { + Box::pin(async move { + println!("non command message!: {}", msg.content); + Ok(()) + }) + }), ..Default::default() }, on_error: |error| { diff --git a/src/dispatch/prefix.rs b/src/dispatch/prefix.rs index a3d9bf3c911e..cdec95adf63f 100644 --- a/src/dispatch/prefix.rs +++ b/src/dispatch/prefix.rs @@ -208,17 +208,15 @@ pub async fn dispatch_message<'a, U: Send + Sync, E>( payload, ctx: ctx.into(), })??; - } else { - if let Some(non_command_message) = framework.options.prefix_options.non_command_message { - non_command_message(&framework, ctx, msg).await.map_err(|e| { - crate::FrameworkError::NonCommandMessage { - error: e, - ctx, - framework, - msg, - } + } else if let Some(non_command_message) = framework.options.prefix_options.non_command_message { + non_command_message(&framework, ctx, msg) + .await + .map_err(|e| crate::FrameworkError::NonCommandMessage { + error: e, + ctx, + framework, + msg, })?; - } } Ok(()) } diff --git a/src/prefix_argument/code_block.rs b/src/prefix_argument/code_block.rs index 92f4acafd4f6..aef7abc00511 100644 --- a/src/prefix_argument/code_block.rs +++ b/src/prefix_argument/code_block.rs @@ -146,7 +146,7 @@ fn test_pop_code_block() { "#![feature(never_type)]\nfn uwu(_: &!) {}", None, ), - ("```c#\nusing System;\n```", "using System;", Some("c#")) + ("```c#\nusing System;\n```", "using System;", Some("c#")), ] { assert_eq!( pop_from(string).unwrap().1, diff --git a/src/structs/framework_error.rs b/src/structs/framework_error.rs index 2ba47dc2e8e4..018d40d8a188 100644 --- a/src/structs/framework_error.rs +++ b/src/structs/framework_error.rs @@ -421,7 +421,11 @@ impl std::fmt::Display for FrameworkError<'_, U, E> { write!(f, "unknown interaction `{}`", interaction.data.name) } Self::NonCommandMessage { msg, .. } => { - write!(f, "error in non-command message handler in <@{}> (message ID {})", msg.channel_id, msg.id) + write!( + f, + "error in non-command message handler in <@{}> (message ID {})", + msg.channel_id, msg.id + ) } Self::__NonExhaustive(unreachable) => match *unreachable {}, }