# Objective `#[derive(Reflect)]` derives `Typed` impls whose `type_info` methods contain useless calls to `with_custom_attributes` and `with_docs`, e.g.: ``` ::bevy::reflect::NamedField:🆕:<f32>("x") .with_custom_attributes( ::bevy::reflect::attributes::CustomAttributes::default() ) .with_docs(::core::option::Option::None), ``` This hurts compile times and makes the `cargo expand` output harder to read. It might also hurt runtime speed, depending on whether the compiler can optimize away the no-op methods. Avoiding this will help with #19873. ## Solution Check if the attributes/docs are empty before appending the method calls. ## Testing I used `cargo expand` to confirm the useless calls are no longer produced. `-Zmacro-stats` outputs tells me this reduces the size of the `Reflect` impls produced for `bevy_ui` from 1_544_696 bytes to 1_511_214 bytes, a 2.2% drop. Only a small improvement, but it's a start. |
||
|---|---|---|
| .. | ||
| src | ||
| Cargo.toml | ||
| LICENSE-APACHE | ||
| LICENSE-MIT | ||