From 034da120ac848314f382f6208c5ba2e7451c477a Mon Sep 17 00:00:00 2001 From: Agatha Rose Date: Sun, 21 Jun 2020 12:28:13 +0300 Subject: [PATCH] Replace .push_str() calls with += operator to clean up code --- src/main.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main.rs b/src/main.rs index f5c333e..dda0d02 100755 --- a/src/main.rs +++ b/src/main.rs @@ -273,7 +273,7 @@ fn servers(ctx: &mut Context, message: &Message) -> CommandResult { let cache = ctx.cache.read(); for (index, guild_lock) in cache.guilds.values().enumerate() { let guild = guild_lock.read(); - list.push_str(&format!("{}: {}\n", index, guild.name)); + list += &format!("{}: {}\n", index, guild.name); } let _ = message .channel_id @@ -434,7 +434,7 @@ fn bottom_rng(ctx: &mut Context, message: &Message, mut args: Args) -> CommandRe messages.retain(|v| v.author != message.mentions[0]); let mut input = String::new(); for msg in messages { - input.push_str(&format!("{} ", msg.content)); + input += &format!("{} ", msg.content); } let result: u64 = StdRng::seed_from_u64(calculate_hash(&input)).gen_range(0, 100); let _ = message.channel_id.send_message(&ctx.http, |m| { @@ -475,7 +475,7 @@ fn ship(ctx: &mut Context, message: &Message, args: Args) -> CommandResult { _ => { let mut first_halves = String::new(); for name in &names[0..names.len() - 1] { - first_halves.push_str(&name[0..name.len() / 2]); + first_halves += &name[0..name.len() / 2]; } let first_halves = first_halves.as_str(); let last_half = &names[names.len() - 1][(names.len() / 2) + 1..];