From fb1cbab4eb1606d7a6e1ca4e58f691939c76031f Mon Sep 17 00:00:00 2001 From: kageru Date: Thu, 25 Nov 2021 22:29:25 +0100 Subject: [PATCH] fmt and clippy --- src/inbox.rs | 2 +- src/reactions.rs | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/inbox.rs b/src/inbox.rs index 103b5cf..6220118 100644 --- a/src/inbox.rs +++ b/src/inbox.rs @@ -68,7 +68,7 @@ impl Inbox { ) }) .map(|_: usize| msg.recipient.clone()) - .map_err(|e| { + .map_err(|e| { eprintln!("{:?}", e); String::from("Beim Speichern deiner Nachricht ist ein Fehler aufgetreten. Bitte sag kageru Bescheid.") }) diff --git a/src/reactions.rs b/src/reactions.rs index 7df855b..7267b7d 100644 --- a/src/reactions.rs +++ b/src/reactions.rs @@ -9,7 +9,7 @@ use std::collections::HashMap; lazy_static! { static ref ROLE_CONFIG: Vec = { let c = serde_json::from_str( - &std::fs::read_to_string("reaction_config.json").unwrap_or("[]".to_string()), + &std::fs::read_to_string("reaction_config.json").unwrap_or_else(|_| "[]".to_string()), ) .expect("Could not read reaction config"); eprintln!("Read reaction config: {:?}", c); @@ -38,10 +38,12 @@ macro_rules! role_action { } pub(crate) async fn reaction_added(ctx: Context, reaction: Reaction) -> serenity::Result<()> { - Ok(role_action!(reaction, ctx, add_role)) + role_action!(reaction, ctx, add_role); + Ok(()) } pub(crate) async fn reaction_removed(ctx: Context, reaction: Reaction) -> serenity::Result<()> { - Ok(role_action!(reaction, ctx, remove_role)) + role_action!(reaction, ctx, remove_role); + Ok(()) } #[derive(Debug, PartialEq, Deserialize)]