bevy/crates/bevy_reflect/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
..
impls Use bevy_reflect as path in case of no direct references (#1875) 2021-05-19 19:03:36 +00:00
serde Avoid some format! into immediate format! (#2913) 2021-10-06 18:34:33 +00:00
lib.rs Use bevy_reflect as path in case of no direct references (#1875) 2021-05-19 19:03:36 +00:00
list.rs Override size_hint for all Iterators and add ExactSizeIterator where applicable (#1734) 2021-04-13 01:28:14 +00:00
map.rs Override size_hint for all Iterators and add ExactSizeIterator where applicable (#1734) 2021-04-13 01:28:14 +00:00
path.rs Use bevy_reflect as path in case of no direct references (#1875) 2021-05-19 19:03:36 +00:00
reflect.rs Avoid some format! into immediate format! (#2913) 2021-10-06 18:34:33 +00:00
struct_trait.rs Override size_hint for all Iterators and add ExactSizeIterator where applicable (#1734) 2021-04-13 01:28:14 +00:00
tuple.rs Override size_hint for all Iterators and add ExactSizeIterator where applicable (#1734) 2021-04-13 01:28:14 +00:00
tuple_struct.rs Override size_hint for all Iterators and add ExactSizeIterator where applicable (#1734) 2021-04-13 01:28:14 +00:00
type_registry.rs Document FromType trait (#2323) 2021-06-09 18:32:18 +00:00
type_uuid.rs revert supporting generics for deriving TypeUuid (#2204) 2021-05-17 20:28:50 +00:00