From afe583034a75f59e52d15e659df0aab3a22adf01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20R=C3=B6ssler?= Date: Wed, 9 Feb 2022 12:49:32 +0100 Subject: [PATCH] change format("{}", VAR) to VAR.to_string() --- egui_demo_lib/src/apps/demo/table_demo.rs | 8 ++++---- .../demo/widget_gallery/serde_date_format.rs | 2 +- egui_extras/src/datepicker/popup.rs | 16 ++++++++-------- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/egui_demo_lib/src/apps/demo/table_demo.rs b/egui_demo_lib/src/apps/demo/table_demo.rs index 55bf7b70..d6c47d77 100644 --- a/egui_demo_lib/src/apps/demo/table_demo.rs +++ b/egui_demo_lib/src/apps/demo/table_demo.rs @@ -56,7 +56,7 @@ impl super::View for TableDemo { if self.virtual_scrool { body.rows(20.0, 100_000, |index, mut row| { row.col(|ui| { - ui.label(format!("{}", index)); + ui.label(index.to_string()); }); row.col(|ui| { ui.add( @@ -65,7 +65,7 @@ impl super::View for TableDemo { ); }); row.col(|ui| { - ui.label(format!("{}", index)); + ui.label(index.to_string()); }); }); } else { @@ -77,7 +77,7 @@ impl super::View for TableDemo { }; body.row(height, |mut row| { row.col(|ui| { - ui.label(format!("{}", i)); + ui.label(i.to_string()); }); row.col(|ui| { ui.add( @@ -88,7 +88,7 @@ impl super::View for TableDemo { ); }); row.col(|ui| { - ui.label(format!("{}", i)); + ui.label(i.to_string()); }); }); } diff --git a/egui_demo_lib/src/apps/demo/widget_gallery/serde_date_format.rs b/egui_demo_lib/src/apps/demo/widget_gallery/serde_date_format.rs index 328be38d..4a70ec7c 100644 --- a/egui_demo_lib/src/apps/demo/widget_gallery/serde_date_format.rs +++ b/egui_demo_lib/src/apps/demo/widget_gallery/serde_date_format.rs @@ -7,7 +7,7 @@ pub fn serialize(date: &Date, serializer: S) -> Result where S: Serializer, { - let s = format!("{}", date.format(FORMAT)); + let s = date.format(FORMAT).to_string(); serializer.serialize_str(&s) } diff --git a/egui_extras/src/datepicker/popup.rs b/egui_extras/src/datepicker/popup.rs index 41f0b28a..5c9eeeb3 100644 --- a/egui_extras/src/datepicker/popup.rs +++ b/egui_extras/src/datepicker/popup.rs @@ -72,14 +72,14 @@ impl<'a> DatePickerPopup<'a> { builder.sizes(Size::Remainder, 3).horizontal(|mut grid| { grid.cell_noclip(|ui| { ComboBox::from_id_source("date_picker_year") - .selected_text(format!("{}", popup_state.year)) + .selected_text(popup_state.year.to_string()) .show_ui(ui, |ui| { for year in today.year() - 5..today.year() + 10 { if ui .selectable_value( &mut popup_state.year, year, - format!("{}", year), + year.to_string(), ) .changed() { @@ -92,14 +92,14 @@ impl<'a> DatePickerPopup<'a> { }); grid.cell_noclip(|ui| { ComboBox::from_id_source("date_picker_month") - .selected_text(format!("{}", popup_state.month)) + .selected_text(popup_state.month.to_string()) .show_ui(ui, |ui| { for month in 1..=12 { if ui .selectable_value( &mut popup_state.month, month, - format!("{}", month), + month.to_string(), ) .changed() { @@ -112,14 +112,14 @@ impl<'a> DatePickerPopup<'a> { }); grid.cell_noclip(|ui| { ComboBox::from_id_source("date_picker_day") - .selected_text(format!("{}", popup_state.day)) + .selected_text(popup_state.day.to_string()) .show_ui(ui, |ui| { for day in 1..=popup_state.last_day_of_month() { if ui .selectable_value( &mut popup_state.day, day, - format!("{}", day), + day.to_string(), ) .changed() { @@ -263,7 +263,7 @@ impl<'a> DatePickerPopup<'a> { body.row(height, |mut row| { if self.calendar_week { row.col(|ui| { - ui.add(Label::new(format!("{}", week.number))); + ui.add(Label::new(week.number.to_string())); }); } for day in week.days { @@ -294,7 +294,7 @@ impl<'a> DatePickerPopup<'a> { }; let button = Button::new( - RichText::new(format!("{}", day.day())) + RichText::new(day.day().to_string()) .color(text_color), ) .fill(fill_color);