Chore: Inline format args for ease of reading

A minor cleanup to inline all simple cases of format arguments. Makes the format strings just a bit easier to read.
This commit is contained in:
Yuri Astrakhan 2023-09-19 01:31:10 -04:00
parent 4613eb26cb
commit 3d6b9637c3
13 changed files with 25 additions and 30 deletions

View file

@ -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

View file

@ -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)]

View file

@ -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) =

View file

@ -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),

View file

@ -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