Replace .push_str() calls with += operator to clean up code

This commit is contained in:
Agatha Lovelace 2020-06-21 12:28:13 +03:00
parent 4f83ece8f8
commit ce14248071
1 changed files with 3 additions and 3 deletions

View File

@ -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..];