diff options
| author | Nathan Perry <np@nathanperry.dev> | 2024-05-08 14:30:21 -0400 |
|---|---|---|
| committer | Nathan Perry <np@nathanperry.dev> | 2024-05-08 14:30:21 -0400 |
| commit | fb088b4ff56ed76dabf4e638cb92bc1b9275fbcc (patch) | |
| tree | 53cb51db079edafd756cae6a3d5fc4fae829429c /src/commands/meme/mod.rs | |
| parent | 47817c4166937af24041a93e56ad9f841bf1e8f1 (diff) | |
clippy fixes
Diffstat (limited to 'src/commands/meme/mod.rs')
| -rw-r--r-- | src/commands/meme/mod.rs | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/commands/meme/mod.rs b/src/commands/meme/mod.rs index fe69b1c..c40e80a 100644 --- a/src/commands/meme/mod.rs +++ b/src/commands/meme/mod.rs @@ -74,7 +74,7 @@ async fn send_meme( msg: &Message, ) -> CommandResult { let should_tts = - t.content.as_ref().map(|t| t.len() > 0).unwrap_or(false) && random::<u32>() % 25 == 0; + t.content.as_ref().map(|t| !t.is_empty()).unwrap_or(false) && random::<u32>() % 25 == 0; debug!("sending meme (tts: {}): {:?}", should_tts, t); @@ -85,7 +85,7 @@ async fn send_meme( let ret = CreateMessage::default().tts(should_tts); match t.content { - Some(ref text) if text.len() > 0 => ret.content(text), + Some(ref text) if !text.is_empty() => ret.content(text), _ => ret, } }; @@ -98,11 +98,10 @@ async fn send_meme( msg.channel_id.send_files(ctx, vec![att], cmsg).await?; }, - None => match t.content { - Some(_) => { + None => { + if t.content.is_some() { msg.channel_id.send_message(ctx, cmsg).await?; - }, - None => {}, + } }, }; |
