remove two unnecessary string heap allocs

Signed-off-by: strawberry <strawberry@puppygock.gay>
This commit is contained in:
strawberry 2024-03-02 17:33:46 -05:00 committed by June
parent a9f714ae8d
commit 04d16ac544
3 changed files with 7 additions and 5 deletions

View file

@ -277,7 +277,7 @@ empty_drop = "warn"
exit = "warn"
filetype_is_file = "warn"
float_cmp_const = "warn"
# format_push_string = "warn"
format_push_string = "warn"
impl_trait_in_params = "warn"
infinite_loop = "warn"
# let_underscore_untyped = "warn"

View file

@ -1,6 +1,7 @@
use std::{
collections::BTreeMap,
fmt,
fmt::Write as _,
net::{IpAddr, Ipv4Addr},
path::PathBuf,
};
@ -398,7 +399,7 @@ impl fmt::Display for Config {
let mut msg: String = "Active config values:\n\n".to_owned();
for line in lines.into_iter().enumerate() {
msg += &format!("{}: {}\n", line.1 .0, line.1 .1);
let _ = writeln!(msg, "{}: {}", line.1 .0, line.1 .1);
}
write!(f, "{msg}")

View file

@ -4,7 +4,7 @@ use std::{
time::Instant,
};
use std::fmt::Write;
use std::fmt::Write as _;
use clap::{Parser, Subcommand};
use regex::Regex;
@ -1730,8 +1730,9 @@ impl Service {
for (r, (e, i)) in map.iter() {
let elapsed = i.elapsed();
msg += &format!(
"{} {}: {}m{}s\n",
let _ = writeln!(
msg,
"{} {}: {}m{}s",
r,
e,
elapsed.as_secs() / 60,