bevy/crates
Stepan Koltsov 405fa3e8ea
Mute non-local definition warnings in bevy_reflect (#16013)
# Objective

```
cargo check -p bevy_reflect
```

outputs a lot of warnings like:

```
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
   --> crates/bevy_reflect/src/impls/std.rs:223:13
    |
223 |               impl_type_path!($ty);
    |               ^-------------------
    |               |
    |               `TypePath` is not local
    |               move the `impl` block outside of this constant `_` and up 2 bodies
...
346 | / impl_reflect_for_atomic!(
347 | |     ::core::sync::atomic::AtomicIsize,
    | |     --------------------------------- `AtomicIsize` is not local
348 | |     ::core::sync::atomic::Ordering::SeqCst
349 | | );
    | |_- in this macro invocation
    |
    = note: the macro `impl_type_path` defines the non-local `impl`, and may need to be changed
    = note: the macro `impl_type_path` may come from an old version of the `bevy_reflect_derive` crate, try updating your dependency with `cargo update -p bevy_reflect_derive`
    = note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
    = note: items in an anonymous const item (`const _: () = { ... }`) are treated as in the same scope as the anonymous const's declaration for the purpose of this lint
    = note: `#[warn(non_local_definitions)]` on by default
    = note: this warning originates in the macro `impl_type_path` which comes from the expansion of the macro `impl_reflect_for_atomic` (in Nightly builds, run with -Z macro-backtrace for more info)

```

## Solution

Move `impl_type_path!` into global scope. Warnings no longer pop up.

## Testing

CI
2024-10-20 13:52:52 +00:00
..
bevy_a11y Add core and alloc over std Lints (#15281) 2024-09-27 00:59:59 +00:00
bevy_animation Fix some duplicate words in docs/comments (#15980) 2024-10-20 01:03:27 +00:00
bevy_app Migrate from Query::single and friends to Single (#15872) 2024-10-13 20:32:06 +00:00
bevy_asset fix: add reflect to SceneInstanceReady and other observers/events (#16018) 2024-10-20 13:51:41 +00:00
bevy_audio Fix audio not playing (#15638) 2024-10-04 01:07:09 +00:00
bevy_color Fix bevy_color not compiling standalone. (#15938) 2024-10-15 23:52:45 +00:00
bevy_core Add core and alloc over std Lints (#15281) 2024-09-27 00:59:59 +00:00
bevy_core_pipeline Remove components if not extracted (#15948) 2024-10-19 15:13:39 +00:00
bevy_derive move ANDROID_APP to bevy_window (#15585) 2024-10-02 03:01:06 +00:00
bevy_dev_tools Merge Style properties into Node. Use ComputedNode for computed properties. (#15975) 2024-10-18 22:25:33 +00:00
bevy_diagnostic aligning public apis of Time,Timer and Stopwatch (#15962) 2024-10-16 21:09:32 +00:00
bevy_dylib Generate links to definition in source code pages on docs.rs and dev-docs.bevyengine.org (#12965) 2024-07-29 23:10:16 +00:00
bevy_ecs fix: add reflect to SceneInstanceReady and other observers/events (#16018) 2024-10-20 13:51:41 +00:00
bevy_encase_derive Update `glam to 0.29, encase` to 0.10. (#15249) 2024-09-23 19:44:02 +00:00
bevy_gilrs Remove thiserror from bevy_gilrs (#15773) 2024-10-09 14:21:25 +00:00
bevy_gizmos Fix gizmos (#15836) 2024-10-10 22:04:04 +00:00
bevy_gltf Improve API for scaling orthographic cameras (#15969) 2024-10-17 17:50:06 +00:00
bevy_hierarchy fix: add reflect to SceneInstanceReady and other observers/events (#16018) 2024-10-20 13:51:41 +00:00
bevy_image Remove AVIF feature (#15973) 2024-10-17 19:47:28 +00:00
bevy_input fix: add reflect to SceneInstanceReady and other observers/events (#16018) 2024-10-20 13:51:41 +00:00
bevy_internal Remove AVIF feature (#15973) 2024-10-17 19:47:28 +00:00
bevy_log Use oslog for ios (#13364) 2024-10-11 08:58:14 +00:00
bevy_macro_utils Modify derive_label to support no_std environments (#15465) 2024-09-27 20:23:26 +00:00
bevy_math Fix some duplicate words in docs/comments (#15980) 2024-10-20 01:03:27 +00:00
bevy_mesh Indices::push(u32) (#16014) 2024-10-20 13:51:55 +00:00
bevy_mikktspace Add no_std support to bevy_mikktspace (#15528) 2024-09-30 18:17:03 +00:00
bevy_pbr Fix some duplicate words in docs/comments (#15980) 2024-10-20 01:03:27 +00:00
bevy_picking fix: add reflect to SceneInstanceReady and other observers/events (#16018) 2024-10-20 13:51:41 +00:00
bevy_ptr Add core and alloc over std Lints (#15281) 2024-09-27 00:59:59 +00:00
bevy_reflect Mute non-local definition warnings in bevy_reflect (#16013) 2024-10-20 13:52:52 +00:00
bevy_remote Feature gate bevy_remote http transport. (#16019) 2024-10-20 13:49:55 +00:00
bevy_render Fix deactivated camera still being used in render world (#15946) 2024-10-19 15:13:14 +00:00
bevy_scene fix: add reflect to SceneInstanceReady and other observers/events (#16018) 2024-10-20 13:51:41 +00:00
bevy_sprite Revert default mesh materials (#15930) 2024-10-15 19:47:40 +00:00
bevy_state Add World::get_resource_or_init as an alternative to World::get_resource_or_insert_with (#15758) 2024-10-09 20:56:26 +00:00
bevy_tasks Resolve unused_qualifications warnings (#16001) 2024-10-19 16:59:58 +00:00
bevy_text Merge Style properties into Node. Use ComputedNode for computed properties. (#15975) 2024-10-18 22:25:33 +00:00
bevy_time aligning public apis of Time,Timer and Stopwatch (#15962) 2024-10-16 21:09:32 +00:00
bevy_transform Remove thiserror from bevy_transform (#15761) 2024-10-09 14:27:30 +00:00
bevy_ui Fix some duplicate words in docs/comments (#15980) 2024-10-20 01:03:27 +00:00
bevy_utils Fix detailed_trace module scope (#15912) 2024-10-15 02:48:36 +00:00
bevy_window Add window drag move and drag resize without decoration example. (#15814) 2024-10-15 23:38:35 +00:00
bevy_winit fix: add reflect to SceneInstanceReady and other observers/events (#16018) 2024-10-20 13:51:41 +00:00