From fb088b4ff56ed76dabf4e638cb92bc1b9275fbcc Mon Sep 17 00:00:00 2001 From: Nathan Perry Date: Wed, 8 May 2024 14:30:21 -0400 Subject: clippy fixes --- src/commands/meme/invoke.rs | 30 ++++++++++++------------------ 1 file changed, 12 insertions(+), 18 deletions(-) (limited to 'src/commands/meme/invoke.rs') diff --git a/src/commands/meme/invoke.rs b/src/commands/meme/invoke.rs index 13996da..2db9e83 100644 --- a/src/commands/meme/invoke.rs +++ b/src/commands/meme/invoke.rs @@ -76,7 +76,7 @@ async fn _meme( args: Args, audio_playback: AudioPlayback, ) -> CommandResult { - if args.len() == 0 || audio_playback != AudioPlayback::Optional { + if args.is_empty() || audio_playback != AudioPlayback::Optional { return rand_meme(ctx, msg, audio_playback).await; } @@ -133,18 +133,15 @@ async fn rand_meme( Ok(()) }, Err(e) => { - match e.downcast_ref::() { - Some(NotFound) => { - info!("random meme not found"); - return util::send(ctx, message.channel_id, "i don't know any :(", message.tts) - .map_err(CommandError::from) - .await; - }, - _ => {}, + if let Some(NotFound) = e.downcast_ref::() { + info!("random meme not found"); + return util::send(ctx, message.channel_id, "i don't know any :(", message.tts) + .map_err(CommandError::from) + .await; } util::send(ctx, message.channel_id, "HELP", message.tts).await?; - return Err(e.into()); + Err(e.into()) }, } } @@ -163,14 +160,11 @@ pub async fn rare_meme(ctx: &Context, msg: &Message, _args: Args) -> CommandResu send_meme(ctx, &meme, &mut conn, msg).await }, Err(e) => { - match e.downcast_ref::() { - Some(NotFound) => { - info!("rare meme not found"); - return util::send(ctx, msg.channel_id, "i don't know any :(", msg.tts) - .map_err(CommandError::from) - .await; - }, - _ => {}, + if let Some(NotFound) = e.downcast_ref::() { + info!("rare meme not found"); + return util::send(ctx, msg.channel_id, "i don't know any :(", msg.tts) + .map_err(CommandError::from) + .await; } util::send(ctx, msg.channel_id, "THE MEME MARKET IS IN FREEFALL", msg.tts) -- cgit v1.3.1