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" exit = "warn"
filetype_is_file = "warn" filetype_is_file = "warn"
float_cmp_const = "warn" float_cmp_const = "warn"
# format_push_string = "warn" format_push_string = "warn"
impl_trait_in_params = "warn" impl_trait_in_params = "warn"
infinite_loop = "warn" infinite_loop = "warn"
# let_underscore_untyped = "warn" # let_underscore_untyped = "warn"

View file

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

View file

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