Skip to content

Commit

Permalink
Format and fix clippy warning
Browse files Browse the repository at this point in the history
  • Loading branch information
GnomedDev committed Jan 16, 2024
1 parent 59dba56 commit 5ed41e9
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 16 deletions.
10 changes: 6 additions & 4 deletions examples/feature_showcase/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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| {
Expand Down
18 changes: 8 additions & 10 deletions src/dispatch/prefix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(())
}
Expand Down
2 changes: 1 addition & 1 deletion src/prefix_argument/code_block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
6 changes: 5 additions & 1 deletion src/structs/framework_error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,11 @@ impl<U, E: std::fmt::Display> 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 {},
}
Expand Down

0 comments on commit 5ed41e9

Please sign in to comment.