Switch 'match' to 'if let' in main.rs::after
This lets us drop a level of indentation, and remove the clunky match arm for Ok(()) => () :)
This commit is contained in:
parent
4eb78cd75a
commit
aecdc7a273
|
@ -91,9 +91,7 @@ async fn dispatch_error(ctx: &Context, msg: &Message, error: DispatchError) {
|
||||||
#[hook]
|
#[hook]
|
||||||
async fn after(ctx: &Context, msg: &Message, command_name: &str, command_result: CommandResult) {
|
async fn after(ctx: &Context, msg: &Message, command_name: &str, command_result: CommandResult) {
|
||||||
// prints error in chat
|
// prints error in chat
|
||||||
match command_result {
|
if let Err(why) = command_result {
|
||||||
Ok(()) => (),
|
|
||||||
Err(why) => {
|
|
||||||
let _ = msg
|
let _ = msg
|
||||||
.channel_id
|
.channel_id
|
||||||
.send_message(&ctx.http, |m| {
|
.send_message(&ctx.http, |m| {
|
||||||
|
@ -115,7 +113,6 @@ async fn after(ctx: &Context, msg: &Message, command_name: &str, command_result:
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[group]
|
#[group]
|
||||||
|
|
Loading…
Reference in New Issue