bevy/crates/bevy_diagnostic/src
Christopher Durham a60fe30ada Avoid some format! into immediate format! (#2913)
# Objective

- Avoid usages of `format!` that ~immediately get passed to another `format!`. This avoids a temporary allocation and is just generally cleaner.

## Solution

- `bevy_derive::shader_defs` does a `format!("{}", val.to_string())`, which is better written as just `format!("{}", val)`
- `bevy_diagnostic::log_diagnostics_plugin` does a `format!("{:>}", format!(...))`, which is better written as `format!("{:>}", format_args!(...))`
- `bevy_ecs::schedule` does `tracing::info!(..., name = &*format!("{:?}", val))`, which is better written with the tracing shorthand `tracing::info!(..., name = ?val)`
- `bevy_reflect::reflect` does `f.write_str(&format!(...))`, which is better written as `write!(f, ...)` (this could also be written using `f.debug_tuple`, but I opted to maintain alt debug behavior)
- `bevy_reflect::serde::{ser, de}` do `serde::Error::custom(format!(...))`, which is better written as `Error::custom(format_args!(...))`, as `Error::custom` takes `impl Display` and just immediately calls `format!` again
2021-10-06 18:34:33 +00:00
..
diagnostic.rs add get_history function to Diagnostic (#2772) 2021-09-06 19:16:08 +00:00
entity_count_diagnostics_plugin.rs Down with the system! (#2496) 2021-07-27 23:42:36 +00:00
frame_time_diagnostics_plugin.rs Down with the system! (#2496) 2021-07-27 23:42:36 +00:00
lib.rs Merge AppBuilder into App (#2531) 2021-07-27 20:21:06 +00:00
log_diagnostics_plugin.rs Avoid some format! into immediate format! (#2913) 2021-10-06 18:34:33 +00:00