bevy/crates/bevy_derive/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
..
app_plugin.rs Various cleanups (#2046) 2021-05-01 20:07:06 +00:00
bevy_main.rs Fix errors and panics to typical Rust conventions (#968) 2020-12-02 11:31:16 -08:00
bytes.rs Use bevy_reflect as path in case of no direct references (#1875) 2021-05-19 19:03:36 +00:00
enum_variant_meta.rs Use bevy_reflect as path in case of no direct references (#1875) 2021-05-19 19:03:36 +00:00
lib.rs Cleanup FromResources (#2601) 2021-08-13 22:21:34 +00:00
modules.rs Cleanup FromResources (#2601) 2021-08-13 22:21:34 +00:00
render_resource.rs Use bevy_reflect as path in case of no direct references (#1875) 2021-05-19 19:03:36 +00:00
render_resources.rs Use bevy_reflect as path in case of no direct references (#1875) 2021-05-19 19:03:36 +00:00
shader_defs.rs Avoid some format! into immediate format! (#2913) 2021-10-06 18:34:33 +00:00