Fix clippy pedantic lints

This commit is contained in:
Aadi Desai 2023-12-08 16:42:31 +00:00
parent 2217d65201
commit 9ade860388
Signed by: supleed2
SSH key fingerprint: SHA256:CkbNRs0yVzXEiUp2zd0PSxsfRUMFF9bLlKXtE1xEbKM
3 changed files with 15 additions and 13 deletions

View file

@ -1,6 +1,7 @@
use crate::{db, ACtx, Error, Gaijin}; use crate::{db, ACtx, Error, Gaijin};
use poise::serenity_prelude as serenity; use poise::serenity_prelude as serenity;
use poise::Modal; use poise::Modal;
use std::fmt::Write;
/// Get the number of entries in the gaijin table /// Get the number of entries in the gaijin table
#[tracing::instrument(skip_all)] #[tracing::instrument(skip_all)]
@ -117,10 +118,10 @@ pub(crate) async fn get_gaijin_by_name(ctx: ACtx<'_>, name: String) -> Result<()
} else { } else {
ctx.say(format!( ctx.say(format!(
"Possible matches for {name}: {}", "Possible matches for {name}: {}",
gaijin gaijin.iter().fold(String::new(), |mut s, g| {
.iter() write!(s, " <@{}>", g.discord_id).expect("String write! is infallible");
.map(|g| format!(" <@{}>", g.discord_id)) s
.collect::<String>() })
)) ))
.await?; .await?;
} }

View file

@ -1,5 +1,6 @@
use crate::{db, ACtx, Error}; use crate::{db, ACtx, Error};
use poise::serenity_prelude as serenity; use poise::serenity_prelude as serenity;
use std::fmt::Write;
/// Unreachable, used to create whois command folder /// Unreachable, used to create whois command folder
#[allow(clippy::unused_async)] #[allow(clippy::unused_async)]
@ -55,10 +56,10 @@ pub(crate) async fn whois_by_nickname(ctx: ACtx<'_>, nickname: String) -> Result
ctx.send(|c| { ctx.send(|c| {
c.ephemeral(true).content(format!( c.ephemeral(true).content(format!(
"Possible matches for {nickname}: {}", "Possible matches for {nickname}: {}",
members members.iter().fold(String::new(), |mut s, g| {
.iter() write!(s, " <@{}>", g.discord_id).expect("String write! is infallible");
.map(|m| format!(" <@{}>", m.discord_id)) s
.collect::<String>() })
)) ))
}) })
.await?; .await?;
@ -90,10 +91,10 @@ pub(crate) async fn whois_by_realname(ctx: ACtx<'_>, realname: String) -> Result
ctx.send(|c| { ctx.send(|c| {
c.ephemeral(true).content(format!( c.ephemeral(true).content(format!(
"Possible matches for {realname}: {}", "Possible matches for {realname}: {}",
members members.iter().fold(String::new(), |mut s, g| {
.iter() write!(s, " <@{}>", g.discord_id).expect("String write! is infallible");
.map(|m| format!(" <@{}>", m.discord_id)) s
.collect::<String>() })
)) ))
}) })
.await?; .await?;

View file

@ -41,7 +41,7 @@ pub(crate) async fn verify(
) )
.await .await
{ {
Ok(_) => { Ok(()) => {
tracing::info!( tracing::info!(
"ID {} added: {}, {}", "ID {} added: {}, {}",
id, id,