Remove unnecessary String allocation

Remove unnecessary String allocation by passing &format! or &x.to_string as impl Into<String>
This commit is contained in:
Ram.Type-0 2021-11-01 23:41:16 +09:00
parent 8a2a7f7e21
commit 0245f289b2
5 changed files with 10 additions and 10 deletions

View file

@ -374,7 +374,7 @@ impl Controls {
.spacing(20)
.align_items(Alignment::Center)
.push(
Text::new(&format!(
Text::new(format!(
"{} {} left",
tasks_left,
if tasks_left == 1 { "task" } else { "tasks" }
@ -464,7 +464,7 @@ const ICONS: Font = Font::External {
};
fn icon(unicode: char) -> Text {
Text::new(&unicode.to_string())
Text::new(unicode.to_string())
.font(ICONS)
.width(Length::Units(20))
.horizontal_alignment(alignment::Horizontal::Center)