fmt and clippy

This commit is contained in:
kageru 2021-11-25 22:29:25 +01:00
parent 0a6b78a007
commit fb1cbab4eb
Signed by: kageru
GPG Key ID: 8282A2BEA4ADA3D2
2 changed files with 6 additions and 4 deletions

View File

@ -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.")
})

View File

@ -9,7 +9,7 @@ use std::collections::HashMap;
lazy_static! {
static ref ROLE_CONFIG: Vec<ReactableMessage> = {
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)]