diff --git a/src/cmds/extras.rs b/src/cmds/extras.rs index cbc538c..06eee24 100644 --- a/src/cmds/extras.rs +++ b/src/cmds/extras.rs @@ -1,6 +1,7 @@ use crate::{db, ACtx, Error, Gaijin}; use poise::serenity_prelude as serenity; use poise::Modal; +use std::fmt::Write; /// Get the number of entries in the gaijin table #[tracing::instrument(skip_all)] @@ -117,10 +118,10 @@ pub(crate) async fn get_gaijin_by_name(ctx: ACtx<'_>, name: String) -> Result<() } else { ctx.say(format!( "Possible matches for {name}: {}", - gaijin - .iter() - .map(|g| format!(" <@{}>", g.discord_id)) - .collect::() + gaijin.iter().fold(String::new(), |mut s, g| { + write!(s, " <@{}>", g.discord_id).expect("String write! is infallible"); + s + }) )) .await?; } diff --git a/src/cmds/whois.rs b/src/cmds/whois.rs index 982d6fe..7f2ab56 100644 --- a/src/cmds/whois.rs +++ b/src/cmds/whois.rs @@ -1,5 +1,6 @@ use crate::{db, ACtx, Error}; use poise::serenity_prelude as serenity; +use std::fmt::Write; /// Unreachable, used to create whois command folder #[allow(clippy::unused_async)] @@ -55,10 +56,10 @@ pub(crate) async fn whois_by_nickname(ctx: ACtx<'_>, nickname: String) -> Result ctx.send(|c| { c.ephemeral(true).content(format!( "Possible matches for {nickname}: {}", - members - .iter() - .map(|m| format!(" <@{}>", m.discord_id)) - .collect::() + members.iter().fold(String::new(), |mut s, g| { + write!(s, " <@{}>", g.discord_id).expect("String write! is infallible"); + s + }) )) }) .await?; @@ -90,10 +91,10 @@ pub(crate) async fn whois_by_realname(ctx: ACtx<'_>, realname: String) -> Result ctx.send(|c| { c.ephemeral(true).content(format!( "Possible matches for {realname}: {}", - members - .iter() - .map(|m| format!(" <@{}>", m.discord_id)) - .collect::() + members.iter().fold(String::new(), |mut s, g| { + write!(s, " <@{}>", g.discord_id).expect("String write! is infallible"); + s + }) )) }) .await?; diff --git a/src/routes.rs b/src/routes.rs index 7bc9af8..8f43958 100644 --- a/src/routes.rs +++ b/src/routes.rs @@ -41,7 +41,7 @@ pub(crate) async fn verify( ) .await { - Ok(_) => { + Ok(()) => { tracing::info!( "ID {} added: {}, {}", id,