summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/game_of_life/src/main.rs3
-rw-r--r--examples/integration/src/main.rs6
-rw-r--r--examples/screenshot/src/main.rs15
-rw-r--r--examples/system_information/src/main.rs4
-rw-r--r--examples/todos/src/main.rs3
-rw-r--r--examples/visible_bounds/src/main.rs2
6 files changed, 15 insertions, 18 deletions
diff --git a/examples/game_of_life/src/main.rs b/examples/game_of_life/src/main.rs
index e451cb06..21a21142 100644
--- a/examples/game_of_life/src/main.rs
+++ b/examples/game_of_life/src/main.rs
@@ -610,8 +610,7 @@ mod grid {
frame.fill_text(Text {
content: format!(
- "{} cell{} @ {:?} ({})",
- cell_count,
+ "{cell_count} cell{} @ {:?} ({})",
if cell_count == 1 { "" } else { "s" },
self.last_tick_duration,
self.last_queued_ticks
diff --git a/examples/integration/src/main.rs b/examples/integration/src/main.rs
index 7945bd20..243297b2 100644
--- a/examples/integration/src/main.rs
+++ b/examples/integration/src/main.rs
@@ -200,8 +200,10 @@ pub fn main() -> Result<(), Box<dyn std::error::Error>> {
viewport.scale_factor(),
)
})
- .map(mouse::Cursor::Available)
- .unwrap_or(mouse::Cursor::Unavailable),
+ .map_or(
+ mouse::Cursor::Unavailable,
+ mouse::Cursor::Available,
+ ),
&mut renderer,
&Theme::Dark,
&renderer::Style {
diff --git a/examples/screenshot/src/main.rs b/examples/screenshot/src/main.rs
index 68c9d031..d9784dc8 100644
--- a/examples/screenshot/src/main.rs
+++ b/examples/screenshot/src/main.rs
@@ -184,8 +184,8 @@ impl Application for Example {
.align_items(Alignment::Center);
if let Some(crop_error) = &self.crop_error {
- crop_controls = crop_controls
- .push(text(format!("Crop error! \n{}", crop_error)));
+ crop_controls =
+ crop_controls.push(text(format!("Crop error! \n{crop_error}")));
}
let mut controls = column![
@@ -221,9 +221,9 @@ impl Application for Example {
if let Some(png_result) = &self.saved_png_path {
let msg = match png_result {
- Ok(path) => format!("Png saved as: {:?}!", path),
+ Ok(path) => format!("Png saved as: {path:?}!"),
Err(msg) => {
- format!("Png could not be saved due to:\n{:?}", msg)
+ format!("Png could not be saved due to:\n{msg:?}")
}
};
@@ -281,7 +281,7 @@ async fn save_to_png(screenshot: Screenshot) -> Result<String, PngError> {
ColorType::Rgba8,
)
.map(|_| path)
- .map_err(|err| PngError(format!("{:?}", err)))
+ .map_err(|err| PngError(format!("{err:?}")))
}
#[derive(Clone, Debug)]
@@ -293,10 +293,7 @@ fn numeric_input(
) -> Element<'_, Option<u32>> {
text_input(
placeholder,
- &value
- .as_ref()
- .map(ToString::to_string)
- .unwrap_or_else(String::new),
+ &value.as_ref().map_or_else(String::new, ToString::to_string),
)
.on_input(move |text| {
if text.is_empty() {
diff --git a/examples/system_information/src/main.rs b/examples/system_information/src/main.rs
index 633b6e2b..507431ee 100644
--- a/examples/system_information/src/main.rs
+++ b/examples/system_information/src/main.rs
@@ -105,8 +105,8 @@ impl Application for Example {
ByteSize::kb(information.memory_total).to_string();
let memory_total = text(format!(
- "Memory (total): {} kb ({})",
- information.memory_total, memory_readable
+ "Memory (total): {} kb ({memory_readable})",
+ information.memory_total,
));
let memory_text = if let Some(memory_used) =
diff --git a/examples/todos/src/main.rs b/examples/todos/src/main.rs
index 501bf67e..3048a668 100644
--- a/examples/todos/src/main.rs
+++ b/examples/todos/src/main.rs
@@ -415,8 +415,7 @@ fn view_controls(tasks: &[Task], current_filter: Filter) -> Element<Message> {
row![
text(format!(
- "{} {} left",
- tasks_left,
+ "{tasks_left} {} left",
if tasks_left == 1 { "task" } else { "tasks" }
))
.width(Length::Fill),
diff --git a/examples/visible_bounds/src/main.rs b/examples/visible_bounds/src/main.rs
index 42dfc24c..697badb4 100644
--- a/examples/visible_bounds/src/main.rs
+++ b/examples/visible_bounds/src/main.rs
@@ -94,7 +94,7 @@ impl Application for Example {
data_row(
label,
match bounds {
- Some(bounds) => format!("{:?}", bounds),
+ Some(bounds) => format!("{bounds:?}"),
None => "not visible".to_string(),
},
if bounds