Merge pull request #1106 from RamType0/RemoveUnnecessaryStringAllocationInExample

Remove unnecessary String allocation
This commit is contained in:
Héctor Ramón 2021-11-10 23:59:35 +07:00 committed by GitHub
commit f084ed8df1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 10 additions and 12 deletions

View file

@ -376,7 +376,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" }
@ -466,7 +466,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)