From aecdc7a2730c77a8051c62bf2db92bda94de8420 Mon Sep 17 00:00:00 2001
From: videogame hacker <half-kh-hacker@hackery.site>
Date: Wed, 7 Jul 2021 12:20:59 +0100
Subject: [PATCH] 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(()) => ()

:)
---
 src/main.rs | 43 ++++++++++++++++++++-----------------------
 1 file changed, 20 insertions(+), 23 deletions(-)

diff --git a/src/main.rs b/src/main.rs
index 5b80c30..17a060d 100755
--- a/src/main.rs
+++ b/src/main.rs
@@ -91,30 +91,27 @@ async fn dispatch_error(ctx: &Context, msg: &Message, error: DispatchError) {
 #[hook]
 async fn after(ctx: &Context, msg: &Message, command_name: &str, command_result: CommandResult) {
     // prints error in chat
-    match command_result {
-        Ok(()) => (),
-        Err(why) => {
-            let _ = msg
-                .channel_id
-                .send_message(&ctx.http, |m| {
-                    m.embed(|e| {
-                        e.title(format!("Error in **{}**", command_name))
-                            .description(&why.to_string())
-                            /*.thumbnail("https://i.imgur.com/VzOEz2E.png") oh no */
-                            .colour(0xff6961)
-                    })
+    if let Err(why) = command_result {
+        let _ = msg
+            .channel_id
+            .send_message(&ctx.http, |m| {
+                m.embed(|e| {
+                    e.title(format!("Error in **{}**", command_name))
+                        .description(&why.to_string())
+                        /*.thumbnail("https://i.imgur.com/VzOEz2E.png") oh no */
+                        .colour(0xff6961)
                 })
-                .await;
-            // prints error in console
-            eprintln!(
-                "{}",
-                format!(
-                    "Error in {}: {}",
-                    command_name.purple(),
-                    &why.to_string().red().bold()
-                )
-            );
-        }
+            })
+            .await;
+        // prints error in console
+        eprintln!(
+            "{}",
+            format!(
+                "Error in {}: {}",
+                command_name.purple(),
+                &why.to_string().red().bold()
+            )
+        );
     }
 }