From c962ca0330c4f5d1f8378dab76d599af2dfd3250 Mon Sep 17 00:00:00 2001 From: Tristan Guichaoua Date: Thu, 24 Aug 2023 10:20:46 +0200 Subject: [PATCH 1/6] fix prelude module docs inconsistency --- crates/bevy_animation/src/lib.rs | 2 +- crates/bevy_app/src/lib.rs | 2 +- crates/bevy_audio/src/lib.rs | 2 +- crates/bevy_core/src/lib.rs | 3 ++- crates/bevy_core_pipeline/src/lib.rs | 1 + crates/bevy_ecs/src/lib.rs | 2 +- crates/bevy_hierarchy/src/lib.rs | 2 +- crates/bevy_input/src/lib.rs | 2 +- crates/bevy_log/src/lib.rs | 2 +- crates/bevy_pbr/src/lib.rs | 1 + crates/bevy_render/src/lib.rs | 1 + crates/bevy_scene/src/lib.rs | 1 + crates/bevy_sprite/src/lib.rs | 1 + crates/bevy_tasks/src/lib.rs | 2 +- crates/bevy_text/src/lib.rs | 1 + crates/bevy_time/src/lib.rs | 2 +- crates/bevy_transform/src/lib.rs | 2 +- crates/bevy_ui/src/lib.rs | 2 +- crates/bevy_utils/src/lib.rs | 2 +- crates/bevy_window/src/lib.rs | 1 + 20 files changed, 21 insertions(+), 13 deletions(-) diff --git a/crates/bevy_animation/src/lib.rs b/crates/bevy_animation/src/lib.rs index b7b8cb1a494b9..8bef7b4843b57 100644 --- a/crates/bevy_animation/src/lib.rs +++ b/crates/bevy_animation/src/lib.rs @@ -18,7 +18,7 @@ use bevy_time::Time; use bevy_transform::{prelude::Transform, TransformSystem}; use bevy_utils::{tracing::warn, HashMap}; -#[allow(missing_docs)] +/// The `bevy_animation` prelude. pub mod prelude { #[doc(hidden)] pub use crate::{ diff --git a/crates/bevy_app/src/lib.rs b/crates/bevy_app/src/lib.rs index 3439620a46633..29d6ecb8779dc 100644 --- a/crates/bevy_app/src/lib.rs +++ b/crates/bevy_app/src/lib.rs @@ -19,7 +19,7 @@ pub use plugin::*; pub use plugin_group::*; pub use schedule_runner::*; -#[allow(missing_docs)] +/// The `bevy_app` prelude. pub mod prelude { #[doc(hidden)] pub use crate::{ diff --git a/crates/bevy_audio/src/lib.rs b/crates/bevy_audio/src/lib.rs index 3b3c8de10a5e9..67eb01c52d87f 100644 --- a/crates/bevy_audio/src/lib.rs +++ b/crates/bevy_audio/src/lib.rs @@ -30,7 +30,7 @@ mod audio_source; mod pitch; mod sinks; -#[allow(missing_docs)] +/// The `bevy_audio` prelude. pub mod prelude { #[doc(hidden)] pub use crate::{ diff --git a/crates/bevy_core/src/lib.rs b/crates/bevy_core/src/lib.rs index 977f01489f286..c601e9aafca20 100644 --- a/crates/bevy_core/src/lib.rs +++ b/crates/bevy_core/src/lib.rs @@ -12,8 +12,9 @@ pub use bytemuck::{bytes_of, cast_slice, Pod, Zeroable}; pub use name::*; pub use task_pool_options::*; + +/// The `bevy_core` Prelude. pub mod prelude { - //! The Bevy Core Prelude. #[doc(hidden)] pub use crate::{ DebugName, FrameCountPlugin, Name, TaskPoolOptions, TaskPoolPlugin, TypeRegistrationPlugin, diff --git a/crates/bevy_core_pipeline/src/lib.rs b/crates/bevy_core_pipeline/src/lib.rs index 51e5ae36278e9..56cef59d279e9 100644 --- a/crates/bevy_core_pipeline/src/lib.rs +++ b/crates/bevy_core_pipeline/src/lib.rs @@ -24,6 +24,7 @@ pub mod experimental { } } +/// The `bevy_core_pipeline` prelude. pub mod prelude { #[doc(hidden)] pub use crate::{ diff --git a/crates/bevy_ecs/src/lib.rs b/crates/bevy_ecs/src/lib.rs index cb91dae60351e..9c5f02f38a097 100644 --- a/crates/bevy_ecs/src/lib.rs +++ b/crates/bevy_ecs/src/lib.rs @@ -25,7 +25,7 @@ use std::any::TypeId; pub use bevy_ptr as ptr; -/// Most commonly used re-exported types. +/// The `bevy_ecs` prelude. pub mod prelude { #[doc(hidden)] #[cfg(feature = "bevy_reflect")] diff --git a/crates/bevy_hierarchy/src/lib.rs b/crates/bevy_hierarchy/src/lib.rs index d616e5384ae13..d46a5011ab041 100644 --- a/crates/bevy_hierarchy/src/lib.rs +++ b/crates/bevy_hierarchy/src/lib.rs @@ -23,7 +23,7 @@ pub use valid_parent_check_plugin::*; mod query_extension; pub use query_extension::*; -#[doc(hidden)] +/// The `bevy_hierarchy` prelude. pub mod prelude { #[doc(hidden)] pub use crate::{ diff --git a/crates/bevy_input/src/lib.rs b/crates/bevy_input/src/lib.rs index 7af8fec03add2..a113bcaf73591 100644 --- a/crates/bevy_input/src/lib.rs +++ b/crates/bevy_input/src/lib.rs @@ -20,7 +20,7 @@ pub mod touchpad; pub use axis::*; pub use input::*; -/// Most commonly used re-exported types. +/// The `bevy_input` prelude. pub mod prelude { #[doc(hidden)] pub use crate::{ diff --git a/crates/bevy_log/src/lib.rs b/crates/bevy_log/src/lib.rs index a912d7d984b5c..1c1734764b933 100644 --- a/crates/bevy_log/src/lib.rs +++ b/crates/bevy_log/src/lib.rs @@ -23,8 +23,8 @@ mod android_tracing; static GLOBAL: tracy_client::ProfiledAllocator = tracy_client::ProfiledAllocator::new(std::alloc::System, 100); +/// The `bevy_log` Prelude. pub mod prelude { - //! The Bevy Log Prelude. #[doc(hidden)] pub use bevy_utils::tracing::{ debug, debug_span, error, error_span, info, info_span, trace, trace_span, warn, warn_span, diff --git a/crates/bevy_pbr/src/lib.rs b/crates/bevy_pbr/src/lib.rs index 32dee04f3419b..12a9f943c0e2f 100644 --- a/crates/bevy_pbr/src/lib.rs +++ b/crates/bevy_pbr/src/lib.rs @@ -26,6 +26,7 @@ pub use prepass::*; pub use render::*; pub use ssao::*; +/// The `bevy_pbr` prelude. pub mod prelude { #[doc(hidden)] pub use crate::{ diff --git a/crates/bevy_render/src/lib.rs b/crates/bevy_render/src/lib.rs index bab3e4b73cacd..b1274a554ad24 100644 --- a/crates/bevy_render/src/lib.rs +++ b/crates/bevy_render/src/lib.rs @@ -29,6 +29,7 @@ use bevy_hierarchy::ValidParentCheckPlugin; use bevy_reflect::TypeUuid; pub use extract_param::Extract; +/// The `bevy_render` prelude. pub mod prelude { #[doc(hidden)] pub use crate::{ diff --git a/crates/bevy_scene/src/lib.rs b/crates/bevy_scene/src/lib.rs index 7725627891e76..c67cfb9870bf8 100644 --- a/crates/bevy_scene/src/lib.rs +++ b/crates/bevy_scene/src/lib.rs @@ -20,6 +20,7 @@ pub use scene_filter::*; pub use scene_loader::*; pub use scene_spawner::*; +/// The `bevy_scene` prelude. pub mod prelude { #[doc(hidden)] pub use crate::{ diff --git a/crates/bevy_sprite/src/lib.rs b/crates/bevy_sprite/src/lib.rs index 545cd19d4768e..6f889a8287f4c 100644 --- a/crates/bevy_sprite/src/lib.rs +++ b/crates/bevy_sprite/src/lib.rs @@ -10,6 +10,7 @@ mod texture_atlas_builder; pub mod collide_aabb; +/// The `bevy_sprite` prelude. pub mod prelude { #[doc(hidden)] pub use crate::{ diff --git a/crates/bevy_tasks/src/lib.rs b/crates/bevy_tasks/src/lib.rs index b97d2e9df466b..a327ac3672437 100644 --- a/crates/bevy_tasks/src/lib.rs +++ b/crates/bevy_tasks/src/lib.rs @@ -31,7 +31,7 @@ pub use thread_executor::{ThreadExecutor, ThreadExecutorTicker}; mod iter; pub use iter::ParallelIterator; -#[allow(missing_docs)] +/// The `bevy_tasks` prelude. pub mod prelude { #[doc(hidden)] pub use crate::{ diff --git a/crates/bevy_text/src/lib.rs b/crates/bevy_text/src/lib.rs index 410dbb2cfac1f..d6fbebebc79ba 100644 --- a/crates/bevy_text/src/lib.rs +++ b/crates/bevy_text/src/lib.rs @@ -20,6 +20,7 @@ pub use pipeline::*; pub use text::*; pub use text2d::*; +/// The `bevy_text` prelude. pub mod prelude { #[doc(hidden)] pub use crate::{Font, Text, Text2dBundle, TextAlignment, TextError, TextSection, TextStyle}; diff --git a/crates/bevy_time/src/lib.rs b/crates/bevy_time/src/lib.rs index 8850572b35961..20e970cd454d7 100644 --- a/crates/bevy_time/src/lib.rs +++ b/crates/bevy_time/src/lib.rs @@ -19,8 +19,8 @@ use bevy_ecs::system::{Res, ResMut}; use bevy_utils::{tracing::warn, Duration, Instant}; use crossbeam_channel::{Receiver, Sender}; +/// The `bevy_time` prelude. pub mod prelude { - //! The Bevy Time Prelude. #[doc(hidden)] pub use crate::{fixed_timestep::FixedTime, Time, Timer, TimerMode}; } diff --git a/crates/bevy_transform/src/lib.rs b/crates/bevy_transform/src/lib.rs index 50444acd8b089..99de9733598ec 100644 --- a/crates/bevy_transform/src/lib.rs +++ b/crates/bevy_transform/src/lib.rs @@ -9,7 +9,7 @@ pub mod components; /// Systems responsible for transform propagation pub mod systems; -#[doc(hidden)] +/// The `bevy_transform` prelude. pub mod prelude { #[doc(hidden)] pub use crate::{ diff --git a/crates/bevy_ui/src/lib.rs b/crates/bevy_ui/src/lib.rs index 1752180b77d86..2171f1d5efd7f 100644 --- a/crates/bevy_ui/src/lib.rs +++ b/crates/bevy_ui/src/lib.rs @@ -31,7 +31,7 @@ pub use render::*; pub use ui_node::*; use widget::UiImageSize; -#[doc(hidden)] +/// The `bevy_ui` prelude. pub mod prelude { #[doc(hidden)] pub use crate::{ diff --git a/crates/bevy_utils/src/lib.rs b/crates/bevy_utils/src/lib.rs index 3dc32e81d8904..315f777c498a8 100644 --- a/crates/bevy_utils/src/lib.rs +++ b/crates/bevy_utils/src/lib.rs @@ -6,7 +6,7 @@ #![warn(missing_docs)] #![warn(clippy::undocumented_unsafe_blocks)] -#[allow(missing_docs)] +/// The `bevy_utils` prelude. pub mod prelude { pub use crate::default; } diff --git a/crates/bevy_window/src/lib.rs b/crates/bevy_window/src/lib.rs index 174f8c11be0a8..4c8293ee307c2 100644 --- a/crates/bevy_window/src/lib.rs +++ b/crates/bevy_window/src/lib.rs @@ -14,6 +14,7 @@ pub use event::*; pub use system::*; pub use window::*; +/// The `bevy_window` prelude. pub mod prelude { #[doc(hidden)] pub use crate::{ From 4037978f2e2c527ec2a078854ce1ebe0c76ea4c3 Mon Sep 17 00:00:00 2001 From: Tristan Guichaoua Date: Thu, 24 Aug 2023 10:33:43 +0200 Subject: [PATCH 2/6] cargo fmt --- crates/bevy_core/src/lib.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/crates/bevy_core/src/lib.rs b/crates/bevy_core/src/lib.rs index c601e9aafca20..19ba143f1bfcc 100644 --- a/crates/bevy_core/src/lib.rs +++ b/crates/bevy_core/src/lib.rs @@ -12,7 +12,6 @@ pub use bytemuck::{bytes_of, cast_slice, Pod, Zeroable}; pub use name::*; pub use task_pool_options::*; - /// The `bevy_core` Prelude. pub mod prelude { #[doc(hidden)] From 3d63ec30eb15b43b6d24188b835f4c285daed9be Mon Sep 17 00:00:00 2001 From: Tristan Guichaoua Date: Sun, 27 Aug 2023 10:13:29 +0200 Subject: [PATCH 3/6] allow missing docs on preludes --- crates/bevy_animation/src/lib.rs | 18 +++++++++++++----- crates/bevy_app/src/lib.rs | 2 +- crates/bevy_asset/src/lib.rs | 2 +- crates/bevy_audio/src/lib.rs | 2 +- crates/bevy_core/src/lib.rs | 2 +- crates/bevy_core_pipeline/src/lib.rs | 2 +- crates/bevy_ecs/src/lib.rs | 2 +- crates/bevy_gizmos/src/lib.rs | 10 +++++++--- crates/bevy_hierarchy/src/lib.rs | 2 +- crates/bevy_input/src/lib.rs | 2 +- crates/bevy_log/src/lib.rs | 2 +- crates/bevy_math/src/lib.rs | 2 +- crates/bevy_pbr/src/lib.rs | 2 +- crates/bevy_render/src/lib.rs | 2 +- crates/bevy_scene/src/lib.rs | 2 +- crates/bevy_sprite/src/lib.rs | 2 +- crates/bevy_tasks/src/lib.rs | 2 +- crates/bevy_text/src/lib.rs | 2 +- crates/bevy_time/src/lib.rs | 2 +- crates/bevy_transform/src/lib.rs | 2 +- crates/bevy_ui/src/lib.rs | 2 +- crates/bevy_utils/src/lib.rs | 2 +- crates/bevy_window/src/lib.rs | 2 +- 23 files changed, 41 insertions(+), 29 deletions(-) diff --git a/crates/bevy_animation/src/lib.rs b/crates/bevy_animation/src/lib.rs index 8bef7b4843b57..b84e871f042d8 100644 --- a/crates/bevy_animation/src/lib.rs +++ b/crates/bevy_animation/src/lib.rs @@ -18,7 +18,7 @@ use bevy_time::Time; use bevy_transform::{prelude::Transform, TransformSystem}; use bevy_utils::{tracing::warn, HashMap}; -/// The `bevy_animation` prelude. +#[allow(missing_docs)] pub mod prelude { #[doc(hidden)] pub use crate::{ @@ -341,9 +341,13 @@ fn verify_no_ancestor_player( player_parent: Option<&Parent>, parents: &Query<(Option>, Option<&Parent>)>, ) -> bool { - let Some(mut current) = player_parent.map(Parent::get) else { return true }; + let Some(mut current) = player_parent.map(Parent::get) else { + return true; + }; loop { - let Ok((maybe_player, parent)) = parents.get(current) else { return true }; + let Ok((maybe_player, parent)) = parents.get(current) else { + return true; + }; if maybe_player.is_some() { return false; } @@ -506,7 +510,9 @@ fn apply_animation( for (path, bone_id) in &animation_clip.paths { let cached_path = &mut animation.path_cache[*bone_id]; let curves = animation_clip.get_curves(*bone_id).unwrap(); - let Some(target) = entity_from_path(root, path, children, names, cached_path) else { continue }; + let Some(target) = entity_from_path(root, path, children, names, cached_path) else { + continue; + }; // SAFETY: The verify_no_ancestor_player check above ensures that two animation players cannot alias // any of their descendant Transforms. // @@ -519,7 +525,9 @@ fn apply_animation( // This means only the AnimationPlayers closest to the root of the hierarchy will be able // to run their animation. Any players in the children or descendants will log a warning // and do nothing. - let Ok(mut transform) = (unsafe { transforms.get_unchecked(target) }) else { continue }; + let Ok(mut transform) = (unsafe { transforms.get_unchecked(target) }) else { + continue; + }; let mut morphs = unsafe { morphs.get_unchecked(target) }; for curve in curves { // Some curves have only one keyframe used to set a transform diff --git a/crates/bevy_app/src/lib.rs b/crates/bevy_app/src/lib.rs index 29d6ecb8779dc..3439620a46633 100644 --- a/crates/bevy_app/src/lib.rs +++ b/crates/bevy_app/src/lib.rs @@ -19,7 +19,7 @@ pub use plugin::*; pub use plugin_group::*; pub use schedule_runner::*; -/// The `bevy_app` prelude. +#[allow(missing_docs)] pub mod prelude { #[doc(hidden)] pub use crate::{ diff --git a/crates/bevy_asset/src/lib.rs b/crates/bevy_asset/src/lib.rs index cc325d26c4dd5..1cab2dfcd9227 100644 --- a/crates/bevy_asset/src/lib.rs +++ b/crates/bevy_asset/src/lib.rs @@ -28,7 +28,7 @@ mod loader; mod path; mod reflect; -/// The `bevy_asset` prelude. +#[allow(missing_docs)] pub mod prelude { #[doc(hidden)] pub use crate::{ diff --git a/crates/bevy_audio/src/lib.rs b/crates/bevy_audio/src/lib.rs index 67eb01c52d87f..3b3c8de10a5e9 100644 --- a/crates/bevy_audio/src/lib.rs +++ b/crates/bevy_audio/src/lib.rs @@ -30,7 +30,7 @@ mod audio_source; mod pitch; mod sinks; -/// The `bevy_audio` prelude. +#[allow(missing_docs)] pub mod prelude { #[doc(hidden)] pub use crate::{ diff --git a/crates/bevy_core/src/lib.rs b/crates/bevy_core/src/lib.rs index 19ba143f1bfcc..85ef58bdfb821 100644 --- a/crates/bevy_core/src/lib.rs +++ b/crates/bevy_core/src/lib.rs @@ -12,7 +12,7 @@ pub use bytemuck::{bytes_of, cast_slice, Pod, Zeroable}; pub use name::*; pub use task_pool_options::*; -/// The `bevy_core` Prelude. +#[allow(missing_docs)] pub mod prelude { #[doc(hidden)] pub use crate::{ diff --git a/crates/bevy_core_pipeline/src/lib.rs b/crates/bevy_core_pipeline/src/lib.rs index 56cef59d279e9..3e1a4a8666a3e 100644 --- a/crates/bevy_core_pipeline/src/lib.rs +++ b/crates/bevy_core_pipeline/src/lib.rs @@ -24,7 +24,7 @@ pub mod experimental { } } -/// The `bevy_core_pipeline` prelude. +#[allow(missing_docs)] pub mod prelude { #[doc(hidden)] pub use crate::{ diff --git a/crates/bevy_ecs/src/lib.rs b/crates/bevy_ecs/src/lib.rs index 9c5f02f38a097..fea5067955fcc 100644 --- a/crates/bevy_ecs/src/lib.rs +++ b/crates/bevy_ecs/src/lib.rs @@ -25,7 +25,7 @@ use std::any::TypeId; pub use bevy_ptr as ptr; -/// The `bevy_ecs` prelude. +#[allow(missing_docs)] pub mod prelude { #[doc(hidden)] #[cfg(feature = "bevy_reflect")] diff --git a/crates/bevy_gizmos/src/lib.rs b/crates/bevy_gizmos/src/lib.rs index 5d21be330a2cb..8abb4e2221359 100644 --- a/crates/bevy_gizmos/src/lib.rs +++ b/crates/bevy_gizmos/src/lib.rs @@ -64,7 +64,7 @@ mod pipeline_3d; use gizmos::{GizmoStorage, Gizmos}; -/// The `bevy_gizmos` prelude. +#[allow(missing_docs)] pub mod prelude { #[doc(hidden)] pub use crate::{gizmos::Gizmos, AabbGizmo, AabbGizmoConfig, GizmoConfig}; @@ -96,7 +96,9 @@ impl Plugin for GizmoPlugin { .after(TransformSystem::TransformPropagate), ); - let Ok(render_app) = app.get_sub_app_mut(RenderApp) else { return; }; + let Ok(render_app) = app.get_sub_app_mut(RenderApp) else { + return; + }; render_app .add_systems(ExtractSchedule, extract_gizmo_data) @@ -109,7 +111,9 @@ impl Plugin for GizmoPlugin { } fn finish(&self, app: &mut bevy_app::App) { - let Ok(render_app) = app.get_sub_app_mut(RenderApp) else { return; }; + let Ok(render_app) = app.get_sub_app_mut(RenderApp) else { + return; + }; let render_device = render_app.world.resource::(); let layout = render_device.create_bind_group_layout(&BindGroupLayoutDescriptor { diff --git a/crates/bevy_hierarchy/src/lib.rs b/crates/bevy_hierarchy/src/lib.rs index d46a5011ab041..edca43c20bdf8 100644 --- a/crates/bevy_hierarchy/src/lib.rs +++ b/crates/bevy_hierarchy/src/lib.rs @@ -23,7 +23,7 @@ pub use valid_parent_check_plugin::*; mod query_extension; pub use query_extension::*; -/// The `bevy_hierarchy` prelude. +#[allow(missing_docs)] pub mod prelude { #[doc(hidden)] pub use crate::{ diff --git a/crates/bevy_input/src/lib.rs b/crates/bevy_input/src/lib.rs index a113bcaf73591..53d686dc5f384 100644 --- a/crates/bevy_input/src/lib.rs +++ b/crates/bevy_input/src/lib.rs @@ -20,7 +20,7 @@ pub mod touchpad; pub use axis::*; pub use input::*; -/// The `bevy_input` prelude. +#[allow(missing_docs)] pub mod prelude { #[doc(hidden)] pub use crate::{ diff --git a/crates/bevy_log/src/lib.rs b/crates/bevy_log/src/lib.rs index 1c1734764b933..ed6947dce7d06 100644 --- a/crates/bevy_log/src/lib.rs +++ b/crates/bevy_log/src/lib.rs @@ -23,7 +23,7 @@ mod android_tracing; static GLOBAL: tracy_client::ProfiledAllocator = tracy_client::ProfiledAllocator::new(std::alloc::System, 100); -/// The `bevy_log` Prelude. +#[allow(missing_docs)] pub mod prelude { #[doc(hidden)] pub use bevy_utils::tracing::{ diff --git a/crates/bevy_math/src/lib.rs b/crates/bevy_math/src/lib.rs index 1c75dc015d01b..f871fcebba455 100644 --- a/crates/bevy_math/src/lib.rs +++ b/crates/bevy_math/src/lib.rs @@ -16,7 +16,7 @@ pub use affine3::*; pub use ray::Ray; pub use rects::*; -/// The `bevy_math` prelude. +#[allow(missing_docs)] pub mod prelude { #[doc(hidden)] pub use crate::{ diff --git a/crates/bevy_pbr/src/lib.rs b/crates/bevy_pbr/src/lib.rs index 12a9f943c0e2f..b79bca2fb24ff 100644 --- a/crates/bevy_pbr/src/lib.rs +++ b/crates/bevy_pbr/src/lib.rs @@ -26,7 +26,7 @@ pub use prepass::*; pub use render::*; pub use ssao::*; -/// The `bevy_pbr` prelude. +#[allow(missing_docs)] pub mod prelude { #[doc(hidden)] pub use crate::{ diff --git a/crates/bevy_render/src/lib.rs b/crates/bevy_render/src/lib.rs index b1274a554ad24..58fd350561bfb 100644 --- a/crates/bevy_render/src/lib.rs +++ b/crates/bevy_render/src/lib.rs @@ -29,7 +29,7 @@ use bevy_hierarchy::ValidParentCheckPlugin; use bevy_reflect::TypeUuid; pub use extract_param::Extract; -/// The `bevy_render` prelude. +#[allow(missing_docs)] pub mod prelude { #[doc(hidden)] pub use crate::{ diff --git a/crates/bevy_scene/src/lib.rs b/crates/bevy_scene/src/lib.rs index c67cfb9870bf8..fb67ed207104c 100644 --- a/crates/bevy_scene/src/lib.rs +++ b/crates/bevy_scene/src/lib.rs @@ -20,7 +20,7 @@ pub use scene_filter::*; pub use scene_loader::*; pub use scene_spawner::*; -/// The `bevy_scene` prelude. +#[allow(missing_docs)] pub mod prelude { #[doc(hidden)] pub use crate::{ diff --git a/crates/bevy_sprite/src/lib.rs b/crates/bevy_sprite/src/lib.rs index 6f889a8287f4c..08299db8abeed 100644 --- a/crates/bevy_sprite/src/lib.rs +++ b/crates/bevy_sprite/src/lib.rs @@ -10,7 +10,7 @@ mod texture_atlas_builder; pub mod collide_aabb; -/// The `bevy_sprite` prelude. +#[allow(missing_docs)] pub mod prelude { #[doc(hidden)] pub use crate::{ diff --git a/crates/bevy_tasks/src/lib.rs b/crates/bevy_tasks/src/lib.rs index a327ac3672437..b97d2e9df466b 100644 --- a/crates/bevy_tasks/src/lib.rs +++ b/crates/bevy_tasks/src/lib.rs @@ -31,7 +31,7 @@ pub use thread_executor::{ThreadExecutor, ThreadExecutorTicker}; mod iter; pub use iter::ParallelIterator; -/// The `bevy_tasks` prelude. +#[allow(missing_docs)] pub mod prelude { #[doc(hidden)] pub use crate::{ diff --git a/crates/bevy_text/src/lib.rs b/crates/bevy_text/src/lib.rs index d6fbebebc79ba..76e6dc27e1c3b 100644 --- a/crates/bevy_text/src/lib.rs +++ b/crates/bevy_text/src/lib.rs @@ -20,7 +20,7 @@ pub use pipeline::*; pub use text::*; pub use text2d::*; -/// The `bevy_text` prelude. +#[allow(missing_docs)] pub mod prelude { #[doc(hidden)] pub use crate::{Font, Text, Text2dBundle, TextAlignment, TextError, TextSection, TextStyle}; diff --git a/crates/bevy_time/src/lib.rs b/crates/bevy_time/src/lib.rs index 20e970cd454d7..09dcc2902997a 100644 --- a/crates/bevy_time/src/lib.rs +++ b/crates/bevy_time/src/lib.rs @@ -19,7 +19,7 @@ use bevy_ecs::system::{Res, ResMut}; use bevy_utils::{tracing::warn, Duration, Instant}; use crossbeam_channel::{Receiver, Sender}; -/// The `bevy_time` prelude. +#[allow(missing_docs)] pub mod prelude { #[doc(hidden)] pub use crate::{fixed_timestep::FixedTime, Time, Timer, TimerMode}; diff --git a/crates/bevy_transform/src/lib.rs b/crates/bevy_transform/src/lib.rs index 99de9733598ec..61b8c46ffb450 100644 --- a/crates/bevy_transform/src/lib.rs +++ b/crates/bevy_transform/src/lib.rs @@ -9,7 +9,7 @@ pub mod components; /// Systems responsible for transform propagation pub mod systems; -/// The `bevy_transform` prelude. +#[allow(missing_docs)] pub mod prelude { #[doc(hidden)] pub use crate::{ diff --git a/crates/bevy_ui/src/lib.rs b/crates/bevy_ui/src/lib.rs index 2171f1d5efd7f..1b545ca53053d 100644 --- a/crates/bevy_ui/src/lib.rs +++ b/crates/bevy_ui/src/lib.rs @@ -31,7 +31,7 @@ pub use render::*; pub use ui_node::*; use widget::UiImageSize; -/// The `bevy_ui` prelude. +#[allow(missing_docs)] pub mod prelude { #[doc(hidden)] pub use crate::{ diff --git a/crates/bevy_utils/src/lib.rs b/crates/bevy_utils/src/lib.rs index 315f777c498a8..3dc32e81d8904 100644 --- a/crates/bevy_utils/src/lib.rs +++ b/crates/bevy_utils/src/lib.rs @@ -6,7 +6,7 @@ #![warn(missing_docs)] #![warn(clippy::undocumented_unsafe_blocks)] -/// The `bevy_utils` prelude. +#[allow(missing_docs)] pub mod prelude { pub use crate::default; } diff --git a/crates/bevy_window/src/lib.rs b/crates/bevy_window/src/lib.rs index 4c8293ee307c2..adb0da7fd8163 100644 --- a/crates/bevy_window/src/lib.rs +++ b/crates/bevy_window/src/lib.rs @@ -14,7 +14,7 @@ pub use event::*; pub use system::*; pub use window::*; -/// The `bevy_window` prelude. +#[allow(missing_docs)] pub mod prelude { #[doc(hidden)] pub use crate::{ From a35a342cd376bf85858bae19c8ce8d1ffa99cd46 Mon Sep 17 00:00:00 2001 From: Tristan Guichaoua Date: Wed, 30 Aug 2023 16:40:10 +0200 Subject: [PATCH 4/6] cargo fmt --- crates/bevy_asset/src/asset_server.rs | 14 +++++++---- crates/bevy_asset/src/io/file_asset_io.rs | 4 +++- crates/bevy_core_pipeline/src/blit/mod.rs | 2 +- crates/bevy_core_pipeline/src/bloom/mod.rs | 5 +++- .../src/contrast_adaptive_sharpening/node.rs | 9 +++++-- .../bevy_core_pipeline/src/msaa_writeback.rs | 2 +- crates/bevy_core_pipeline/src/taa/mod.rs | 14 +++++------ crates/bevy_ecs/macros/src/fetch.rs | 2 +- crates/bevy_ecs/macros/src/lib.rs | 15 ++++++++---- crates/bevy_ecs/src/schedule/schedule.rs | 4 ++-- crates/bevy_ecs/src/world/mod.rs | 5 ++-- crates/bevy_gizmos/src/pipeline_2d.rs | 12 +++++++--- crates/bevy_gizmos/src/pipeline_3d.rs | 12 +++++++--- crates/bevy_pbr/src/prepass/mod.rs | 4 +++- crates/bevy_pbr/src/ssao/mod.rs | 11 ++++++--- .../bevy_reflect_derive/src/derive_data.rs | 6 +++-- crates/bevy_reflect/src/struct_trait.rs | 2 +- crates/bevy_render/src/color/mod.rs | 12 +++++++--- crates/bevy_render/src/mesh/morph.rs | 7 ++++-- crates/bevy_render/src/pipelined_rendering.rs | 4 +++- crates/bevy_render/src/render_graph/graph.rs | 4 +++- crates/bevy_render/src/render_graph/node.rs | 7 +++--- crates/bevy_ui/src/render/render_pass.rs | 8 +++---- crates/bevy_winit/src/lib.rs | 24 +++++++++---------- examples/2d/texture_atlas.rs | 5 +++- examples/animation/morph_targets.rs | 8 +++++-- examples/shader/post_processing.rs | 3 ++- examples/shader/texture_binding_array.rs | 2 +- examples/stress_tests/many_gizmos.rs | 5 +++- .../tools/scene_viewer/morph_viewer_plugin.rs | 8 +++++-- 30 files changed, 146 insertions(+), 74 deletions(-) diff --git a/crates/bevy_asset/src/asset_server.rs b/crates/bevy_asset/src/asset_server.rs index e5daf11126777..11dbd21b37e28 100644 --- a/crates/bevy_asset/src/asset_server.rs +++ b/crates/bevy_asset/src/asset_server.rs @@ -790,7 +790,8 @@ mod test { let asset_server = setup("."); asset_server.add_loader(FakePngLoader); - let Ok(MaybeAssetLoader::Ready(t)) = asset_server.get_path_asset_loader("test.png", true) else { + let Ok(MaybeAssetLoader::Ready(t)) = asset_server.get_path_asset_loader("test.png", true) + else { panic!(); }; @@ -802,7 +803,8 @@ mod test { let asset_server = setup("."); asset_server.add_loader(FakePngLoader); - let Ok(MaybeAssetLoader::Ready(t)) = asset_server.get_path_asset_loader("test.PNG", true) else { + let Ok(MaybeAssetLoader::Ready(t)) = asset_server.get_path_asset_loader("test.PNG", true) + else { panic!(); }; assert_eq!(t.extensions()[0], "png"); @@ -855,7 +857,9 @@ mod test { let asset_server = setup("."); asset_server.add_loader(FakePngLoader); - let Ok(MaybeAssetLoader::Ready(t)) = asset_server.get_path_asset_loader("test-v1.2.3.png", true) else { + let Ok(MaybeAssetLoader::Ready(t)) = + asset_server.get_path_asset_loader("test-v1.2.3.png", true) + else { panic!(); }; assert_eq!(t.extensions()[0], "png"); @@ -866,7 +870,9 @@ mod test { let asset_server = setup("."); asset_server.add_loader(FakeMultipleDotLoader); - let Ok(MaybeAssetLoader::Ready(t)) = asset_server.get_path_asset_loader("test.test.png", true) else { + let Ok(MaybeAssetLoader::Ready(t)) = + asset_server.get_path_asset_loader("test.test.png", true) + else { panic!(); }; assert_eq!(t.extensions()[0], "test.png"); diff --git a/crates/bevy_asset/src/io/file_asset_io.rs b/crates/bevy_asset/src/io/file_asset_io.rs index 9dabb1b1b5a94..1c4f56f28ac4b 100644 --- a/crates/bevy_asset/src/io/file_asset_io.rs +++ b/crates/bevy_asset/src/io/file_asset_io.rs @@ -201,7 +201,9 @@ pub fn filesystem_watcher_system( } = event { for path in &paths { - let Some(set) = watcher.path_map.get(path) else {continue}; + let Some(set) = watcher.path_map.get(path) else { + continue; + }; for to_reload in set { // When an asset is modified, note down the timestamp (overriding any previous modification events) changed.insert(to_reload.to_owned(), Instant::now()); diff --git a/crates/bevy_core_pipeline/src/blit/mod.rs b/crates/bevy_core_pipeline/src/blit/mod.rs index 2bc2f63ea90e8..98442953bd712 100644 --- a/crates/bevy_core_pipeline/src/blit/mod.rs +++ b/crates/bevy_core_pipeline/src/blit/mod.rs @@ -19,7 +19,7 @@ impl Plugin for BlitPlugin { fn finish(&self, app: &mut App) { let Ok(render_app) = app.get_sub_app_mut(RenderApp) else { - return + return; }; render_app diff --git a/crates/bevy_core_pipeline/src/bloom/mod.rs b/crates/bevy_core_pipeline/src/bloom/mod.rs index e5271544e2d78..5ec42d0c2e5cd 100644 --- a/crates/bevy_core_pipeline/src/bloom/mod.rs +++ b/crates/bevy_core_pipeline/src/bloom/mod.rs @@ -163,7 +163,10 @@ impl ViewNode for BloomNode { pipeline_cache.get_render_pipeline(downsampling_pipeline_ids.main), pipeline_cache.get_render_pipeline(upsampling_pipeline_ids.id_main), pipeline_cache.get_render_pipeline(upsampling_pipeline_ids.id_final), - ) else { return Ok(()) }; + ) + else { + return Ok(()); + }; render_context.command_encoder().push_debug_group("bloom"); diff --git a/crates/bevy_core_pipeline/src/contrast_adaptive_sharpening/node.rs b/crates/bevy_core_pipeline/src/contrast_adaptive_sharpening/node.rs index c49d876f2214d..0dd3f086ee27c 100644 --- a/crates/bevy_core_pipeline/src/contrast_adaptive_sharpening/node.rs +++ b/crates/bevy_core_pipeline/src/contrast_adaptive_sharpening/node.rs @@ -53,10 +53,15 @@ impl Node for CASNode { let sharpening_pipeline = world.resource::(); let uniforms = world.resource::>(); - let Ok((target, pipeline, uniform_index)) = self.query.get_manual(world, view_entity) else { return Ok(()) }; + let Ok((target, pipeline, uniform_index)) = self.query.get_manual(world, view_entity) + else { + return Ok(()); + }; let uniforms_id = uniforms.buffer().unwrap().id(); - let Some(uniforms) = uniforms.binding() else { return Ok(()) }; + let Some(uniforms) = uniforms.binding() else { + return Ok(()); + }; let pipeline = pipeline_cache.get_render_pipeline(pipeline.0).unwrap(); diff --git a/crates/bevy_core_pipeline/src/msaa_writeback.rs b/crates/bevy_core_pipeline/src/msaa_writeback.rs index cf881b07b608e..cd925c37225d5 100644 --- a/crates/bevy_core_pipeline/src/msaa_writeback.rs +++ b/crates/bevy_core_pipeline/src/msaa_writeback.rs @@ -21,7 +21,7 @@ pub struct MsaaWritebackPlugin; impl Plugin for MsaaWritebackPlugin { fn build(&self, app: &mut App) { let Ok(render_app) = app.get_sub_app_mut(RenderApp) else { - return + return; }; render_app.add_systems( diff --git a/crates/bevy_core_pipeline/src/taa/mod.rs b/crates/bevy_core_pipeline/src/taa/mod.rs index 01e75ddd15f50..66097d3beeb20 100644 --- a/crates/bevy_core_pipeline/src/taa/mod.rs +++ b/crates/bevy_core_pipeline/src/taa/mod.rs @@ -57,7 +57,9 @@ impl Plugin for TemporalAntiAliasPlugin { app.insert_resource(Msaa::Off) .register_type::(); - let Ok(render_app) = app.get_sub_app_mut(RenderApp) else { return }; + let Ok(render_app) = app.get_sub_app_mut(RenderApp) else { + return; + }; render_app .init_resource::>() @@ -86,7 +88,9 @@ impl Plugin for TemporalAntiAliasPlugin { } fn finish(&self, app: &mut App) { - let Ok(render_app) = app.get_sub_app_mut(RenderApp) else { return }; + let Ok(render_app) = app.get_sub_app_mut(RenderApp) else { + return; + }; render_app.init_resource::(); } @@ -188,11 +192,7 @@ impl ViewNode for TAANode { ) else { return Ok(()); }; - let ( - Some(taa_pipeline), - Some(prepass_motion_vectors_texture), - Some(prepass_depth_texture), - ) = ( + let (Some(taa_pipeline), Some(prepass_motion_vectors_texture), Some(prepass_depth_texture)) = ( pipeline_cache.get_render_pipeline(taa_pipeline_id.0), &prepass_textures.motion_vectors, &prepass_textures.depth, diff --git a/crates/bevy_ecs/macros/src/fetch.rs b/crates/bevy_ecs/macros/src/fetch.rs index 987ee67dc4cae..e28d33475b778 100644 --- a/crates/bevy_ecs/macros/src/fetch.rs +++ b/crates/bevy_ecs/macros/src/fetch.rs @@ -135,7 +135,7 @@ pub fn derive_world_query_impl(input: TokenStream) -> TokenStream { "#[derive(WorldQuery)]` only supports structs", ) .into_compile_error() - .into() + .into(); }; let mut field_attrs = Vec::new(); diff --git a/crates/bevy_ecs/macros/src/lib.rs b/crates/bevy_ecs/macros/src/lib.rs index 110df68260981..5bfbb3cfee1e6 100644 --- a/crates/bevy_ecs/macros/src/lib.rs +++ b/crates/bevy_ecs/macros/src/lib.rs @@ -251,10 +251,17 @@ pub fn impl_param_set(_input: TokenStream) -> TokenStream { pub fn derive_system_param(input: TokenStream) -> TokenStream { let token_stream = input.clone(); let ast = parse_macro_input!(input as DeriveInput); - let syn::Data::Struct(syn::DataStruct { fields: field_definitions, .. }) = ast.data else { - return syn::Error::new(ast.span(), "Invalid `SystemParam` type: expected a `struct`") - .into_compile_error() - .into(); + let syn::Data::Struct(syn::DataStruct { + fields: field_definitions, + .. + }) = ast.data + else { + return syn::Error::new( + ast.span(), + "Invalid `SystemParam` type: expected a `struct`", + ) + .into_compile_error() + .into(); }; let path = bevy_ecs_path(); diff --git a/crates/bevy_ecs/src/schedule/schedule.rs b/crates/bevy_ecs/src/schedule/schedule.rs index cb9ab0a978335..4f1b90ff9050d 100644 --- a/crates/bevy_ecs/src/schedule/schedule.rs +++ b/crates/bevy_ecs/src/schedule/schedule.rs @@ -550,8 +550,8 @@ impl ScheduleGraph { let Some(prev) = config_iter.next() else { return AddSystemsInnerResult { nodes: Vec::new(), - densely_chained: true - } + densely_chained: true, + }; }; let mut previous_result = self.add_systems_inner(prev, true); densely_chained = previous_result.densely_chained; diff --git a/crates/bevy_ecs/src/world/mod.rs b/crates/bevy_ecs/src/world/mod.rs index 82f2456b58322..0e79b19ce8568 100644 --- a/crates/bevy_ecs/src/world/mod.rs +++ b/crates/bevy_ecs/src/world/mod.rs @@ -1770,8 +1770,9 @@ impl World { f: impl FnOnce(&mut World, &mut Schedule) -> R, ) -> Result { let label = label.as_ref(); - let Some((extracted_label, mut schedule)) - = self.get_resource_mut::().and_then(|mut s| s.remove_entry(label)) + let Some((extracted_label, mut schedule)) = self + .get_resource_mut::() + .and_then(|mut s| s.remove_entry(label)) else { return Err(TryRunScheduleError(label.dyn_clone())); }; diff --git a/crates/bevy_gizmos/src/pipeline_2d.rs b/crates/bevy_gizmos/src/pipeline_2d.rs index 06f21138d8a55..128998b0b834b 100644 --- a/crates/bevy_gizmos/src/pipeline_2d.rs +++ b/crates/bevy_gizmos/src/pipeline_2d.rs @@ -27,7 +27,9 @@ pub struct LineGizmo2dPlugin; impl Plugin for LineGizmo2dPlugin { fn build(&self, app: &mut App) { - let Ok(render_app) = app.get_sub_app_mut(RenderApp) else { return }; + let Ok(render_app) = app.get_sub_app_mut(RenderApp) else { + return; + }; render_app .add_render_command::() @@ -36,7 +38,9 @@ impl Plugin for LineGizmo2dPlugin { } fn finish(&self, app: &mut App) { - let Ok(render_app) = app.get_sub_app_mut(RenderApp) else { return }; + let Ok(render_app) = app.get_sub_app_mut(RenderApp) else { + return; + }; render_app.init_resource::(); } @@ -151,7 +155,9 @@ fn queue_line_gizmos_2d( | Mesh2dPipelineKey::from_hdr(view.hdr); for (entity, handle) in &line_gizmos { - let Some(line_gizmo) = line_gizmo_assets.get(handle) else { continue }; + let Some(line_gizmo) = line_gizmo_assets.get(handle) else { + continue; + }; let pipeline = pipelines.specialize( &pipeline_cache, diff --git a/crates/bevy_gizmos/src/pipeline_3d.rs b/crates/bevy_gizmos/src/pipeline_3d.rs index 14f033f30455f..9d015f0f047f7 100644 --- a/crates/bevy_gizmos/src/pipeline_3d.rs +++ b/crates/bevy_gizmos/src/pipeline_3d.rs @@ -25,7 +25,9 @@ use bevy_render::{ pub struct LineGizmo3dPlugin; impl Plugin for LineGizmo3dPlugin { fn build(&self, app: &mut App) { - let Ok(render_app) = app.get_sub_app_mut(RenderApp) else { return }; + let Ok(render_app) = app.get_sub_app_mut(RenderApp) else { + return; + }; render_app .add_render_command::() @@ -34,7 +36,9 @@ impl Plugin for LineGizmo3dPlugin { } fn finish(&self, app: &mut App) { - let Ok(render_app) = app.get_sub_app_mut(RenderApp) else { return }; + let Ok(render_app) = app.get_sub_app_mut(RenderApp) else { + return; + }; render_app.init_resource::(); } @@ -164,7 +168,9 @@ fn queue_line_gizmos_3d( | MeshPipelineKey::from_hdr(view.hdr); for (entity, handle) in &line_gizmos { - let Some(line_gizmo) = line_gizmo_assets.get(handle) else { continue }; + let Some(line_gizmo) = line_gizmo_assets.get(handle) else { + continue; + }; let pipeline = pipelines.specialize( &pipeline_cache, diff --git a/crates/bevy_pbr/src/prepass/mod.rs b/crates/bevy_pbr/src/prepass/mod.rs index bfdd3ff0032cd..c402b30e0aa6f 100644 --- a/crates/bevy_pbr/src/prepass/mod.rs +++ b/crates/bevy_pbr/src/prepass/mod.rs @@ -809,7 +809,9 @@ pub fn queue_prepass_material_meshes( let rangefinder = view.rangefinder3d(); for visible_entity in &visible_entities.entities { - let Ok((material_handle, mesh_handle, mesh_transforms, batch_indices)) = material_meshes.get(*visible_entity) else { + let Ok((material_handle, mesh_handle, mesh_transforms, batch_indices)) = + material_meshes.get(*visible_entity) + else { continue; }; diff --git a/crates/bevy_pbr/src/ssao/mod.rs b/crates/bevy_pbr/src/ssao/mod.rs index 276ee261a5e01..e2d016b95738a 100644 --- a/crates/bevy_pbr/src/ssao/mod.rs +++ b/crates/bevy_pbr/src/ssao/mod.rs @@ -86,7 +86,9 @@ impl Plugin for ScreenSpaceAmbientOcclusionPlugin { } fn finish(&self, app: &mut App) { - let Ok(render_app) = app.get_sub_app_mut(RenderApp) else { return }; + let Ok(render_app) = app.get_sub_app_mut(RenderApp) else { + return; + }; if !render_app .world @@ -226,7 +228,8 @@ impl ViewNode for SsaoNode { pipeline_cache.get_compute_pipeline(pipelines.preprocess_depth_pipeline), pipeline_cache.get_compute_pipeline(pipelines.spatial_denoise_pipeline), pipeline_cache.get_compute_pipeline(pipeline_id.0), - ) else { + ) + else { return Ok(()); }; @@ -640,7 +643,9 @@ fn prepare_ssao_textures( views: Query<(Entity, &ExtractedCamera), With>, ) { for (entity, camera) in &views { - let Some(physical_viewport_size) = camera.physical_viewport_size else { continue }; + let Some(physical_viewport_size) = camera.physical_viewport_size else { + continue; + }; let size = Extent3d { width: physical_viewport_size.x, height: physical_viewport_size.y, diff --git a/crates/bevy_reflect/bevy_reflect_derive/src/derive_data.rs b/crates/bevy_reflect/bevy_reflect_derive/src/derive_data.rs index ada309aacfde4..27a298044ebaa 100644 --- a/crates/bevy_reflect/bevy_reflect_derive/src/derive_data.rs +++ b/crates/bevy_reflect/bevy_reflect_derive/src/derive_data.rs @@ -195,7 +195,8 @@ impl<'a> ReflectDerive<'a> { let syn::Expr::Lit(syn::ExprLit { lit: syn::Lit::Str(lit), .. - }) = &pair.value else { + }) = &pair.value + else { return Err(syn::Error::new( pair.span(), format_args!("`#[{TYPE_PATH_ATTRIBUTE_NAME} = \"...\"]` must be a string literal"), @@ -211,7 +212,8 @@ impl<'a> ReflectDerive<'a> { let syn::Expr::Lit(syn::ExprLit { lit: syn::Lit::Str(lit), .. - }) = &pair.value else { + }) = &pair.value + else { return Err(syn::Error::new( pair.span(), format_args!("`#[{TYPE_NAME_ATTRIBUTE_NAME} = \"...\"]` must be a string literal"), diff --git a/crates/bevy_reflect/src/struct_trait.rs b/crates/bevy_reflect/src/struct_trait.rs index 36e3aaa56a830..f2bb3a4563fd1 100644 --- a/crates/bevy_reflect/src/struct_trait.rs +++ b/crates/bevy_reflect/src/struct_trait.rs @@ -507,7 +507,7 @@ impl Debug for DynamicStruct { /// Returns [`None`] if the comparison couldn't even be performed. #[inline] pub fn struct_partial_eq(a: &S, b: &dyn Reflect) -> Option { - let ReflectRef::Struct(struct_value) = b.reflect_ref() else { + let ReflectRef::Struct(struct_value) = b.reflect_ref() else { return Some(false); }; diff --git a/crates/bevy_render/src/color/mod.rs b/crates/bevy_render/src/color/mod.rs index c5839b7cd4266..deb642a131396 100644 --- a/crates/bevy_render/src/color/mod.rs +++ b/crates/bevy_render/src/color/mod.rs @@ -1990,8 +1990,14 @@ mod tests { let hsla = Color::hsla(0., 0., 0., 0.); let lcha = Color::lcha(0., 0., 0., 0.); assert_eq!(rgba_l, rgba_l.as_rgba_linear()); - let Color::RgbaLinear { .. } = rgba.as_rgba_linear() else { panic!("from Rgba") }; - let Color::RgbaLinear { .. } = hsla.as_rgba_linear() else { panic!("from Hsla") }; - let Color::RgbaLinear { .. } = lcha.as_rgba_linear() else { panic!("from Lcha") }; + let Color::RgbaLinear { .. } = rgba.as_rgba_linear() else { + panic!("from Rgba") + }; + let Color::RgbaLinear { .. } = hsla.as_rgba_linear() else { + panic!("from Hsla") + }; + let Color::RgbaLinear { .. } = lcha.as_rgba_linear() else { + panic!("from Lcha") + }; } } diff --git a/crates/bevy_render/src/mesh/morph.rs b/crates/bevy_render/src/mesh/morph.rs index be52d1f59b495..cb523113be231 100644 --- a/crates/bevy_render/src/mesh/morph.rs +++ b/crates/bevy_render/src/mesh/morph.rs @@ -74,8 +74,11 @@ impl MorphTargetImage { return Err(MorphBuildError::TooManyTargets { target_count }); } let component_count = (vertex_count * MorphAttributes::COMPONENT_COUNT) as u32; - let Some((Rect(width, height), padding)) = lowest_2d(component_count , max) else { - return Err(MorphBuildError::TooManyAttributes { vertex_count, component_count }); + let Some((Rect(width, height), padding)) = lowest_2d(component_count, max) else { + return Err(MorphBuildError::TooManyAttributes { + vertex_count, + component_count, + }); }; let data = targets .flat_map(|mut attributes| { diff --git a/crates/bevy_render/src/pipelined_rendering.rs b/crates/bevy_render/src/pipelined_rendering.rs index 0e2417e51d730..f8fcfe53e978e 100644 --- a/crates/bevy_render/src/pipelined_rendering.rs +++ b/crates/bevy_render/src/pipelined_rendering.rs @@ -111,7 +111,9 @@ impl Plugin for PipelinedRenderingPlugin { s.spawn(async { app_to_render_receiver.recv().await }); }) .pop(); - let Some(Ok(mut render_app)) = sent_app else { break }; + let Some(Ok(mut render_app)) = sent_app else { + break; + }; { #[cfg(feature = "trace")] diff --git a/crates/bevy_render/src/render_graph/graph.rs b/crates/bevy_render/src/render_graph/graph.rs index 87fc063ee13f9..e0bdc9283ce1d 100644 --- a/crates/bevy_render/src/render_graph/graph.rs +++ b/crates/bevy_render/src/render_graph/graph.rs @@ -125,7 +125,9 @@ impl RenderGraph { /// It simply won't create a new edge. pub fn add_node_edges(&mut self, edges: &[&'static str]) { for window in edges.windows(2) { - let [a, b] = window else { break; }; + let [a, b] = window else { + break; + }; if let Err(err) = self.try_add_node_edge(*a, *b) { match err { // Already existing edges are very easy to produce with this api diff --git a/crates/bevy_render/src/render_graph/node.rs b/crates/bevy_render/src/render_graph/node.rs index 9307c235a062e..0e4630e3c72ef 100644 --- a/crates/bevy_render/src/render_graph/node.rs +++ b/crates/bevy_render/src/render_graph/node.rs @@ -398,10 +398,9 @@ where render_context: &mut RenderContext, world: &World, ) -> Result<(), NodeRunError> { - let Ok(view) = self - .view_query - .get_manual(world, graph.view_entity()) - else { return Ok(()); }; + let Ok(view) = self.view_query.get_manual(world, graph.view_entity()) else { + return Ok(()); + }; ViewNode::run(&self.node, graph, render_context, view, world)?; Ok(()) diff --git a/crates/bevy_ui/src/render/render_pass.rs b/crates/bevy_ui/src/render/render_pass.rs index 90e7b6059cecc..80985b2f26db2 100644 --- a/crates/bevy_ui/src/render/render_pass.rs +++ b/crates/bevy_ui/src/render/render_pass.rs @@ -49,10 +49,10 @@ impl Node for UiPassNode { let input_view_entity = graph.view_entity(); let Ok((transparent_phase, target, camera_ui)) = - self.ui_view_query.get_manual(world, input_view_entity) - else { - return Ok(()); - }; + self.ui_view_query.get_manual(world, input_view_entity) + else { + return Ok(()); + }; if transparent_phase.items.is_empty() { return Ok(()); } diff --git a/crates/bevy_winit/src/lib.rs b/crates/bevy_winit/src/lib.rs index 504c70ac43ab6..8c79494dec350 100644 --- a/crates/bevy_winit/src/lib.rs +++ b/crates/bevy_winit/src/lib.rs @@ -422,20 +422,20 @@ pub fn winit_runner(mut app: App) { event_writer_system_state.get_mut(&mut app.world); let Some(window_entity) = winit_windows.get_window_entity(window_id) else { - warn!( - "Skipped event {:?} for unknown winit Window Id {:?}", - event, window_id - ); - return; - }; + warn!( + "Skipped event {:?} for unknown winit Window Id {:?}", + event, window_id + ); + return; + }; let Ok((mut window, mut cache)) = windows.get_mut(window_entity) else { - warn!( - "Window {:?} is missing `Window` component, skipping event {:?}", - window_entity, event - ); - return; - }; + warn!( + "Window {:?} is missing `Window` component, skipping event {:?}", + window_entity, event + ); + return; + }; runner_state.window_event_received = true; diff --git a/examples/2d/texture_atlas.rs b/examples/2d/texture_atlas.rs index b1f6cb21137fc..14fda578398d4 100644 --- a/examples/2d/texture_atlas.rs +++ b/examples/2d/texture_atlas.rs @@ -56,7 +56,10 @@ fn setup( for handle in &rpg_sprite_handles.handles { let handle = handle.typed_weak(); let Some(texture) = textures.get(&handle) else { - warn!("{:?} did not resolve to an `Image` asset.", asset_server.get_handle_path(handle)); + warn!( + "{:?} did not resolve to an `Image` asset.", + asset_server.get_handle_path(handle) + ); continue; }; diff --git a/examples/animation/morph_targets.rs b/examples/animation/morph_targets.rs index e773fb6cf9b32..83f216fc33dc7 100644 --- a/examples/animation/morph_targets.rs +++ b/examples/animation/morph_targets.rs @@ -88,8 +88,12 @@ fn name_morphs( return; } - let Some(mesh) = meshes.get(&morph_data.mesh) else { return }; - let Some(names) = mesh.morph_target_names() else { return }; + let Some(mesh) = meshes.get(&morph_data.mesh) else { + return; + }; + let Some(names) = mesh.morph_target_names() else { + return; + }; for name in names { println!(" {name}"); } diff --git a/examples/shader/post_processing.rs b/examples/shader/post_processing.rs index 88d197ae72bf7..7aed8e8f85d8c 100644 --- a/examples/shader/post_processing.rs +++ b/examples/shader/post_processing.rs @@ -158,7 +158,8 @@ impl ViewNode for PostProcessNode { let pipeline_cache = world.resource::(); // Get the pipeline from the cache - let Some(pipeline) = pipeline_cache.get_render_pipeline(post_process_pipeline.pipeline_id) else { + let Some(pipeline) = pipeline_cache.get_render_pipeline(post_process_pipeline.pipeline_id) + else { return Ok(()); }; diff --git a/examples/shader/texture_binding_array.rs b/examples/shader/texture_binding_array.rs index c4affd57c1d2f..90bf00afc705b 100644 --- a/examples/shader/texture_binding_array.rs +++ b/examples/shader/texture_binding_array.rs @@ -37,7 +37,7 @@ impl Plugin for GpuFeatureSupportChecker { fn finish(&self, app: &mut App) { let Ok(render_app) = app.get_sub_app_mut(RenderApp) else { - return + return; }; let render_device = render_app.world.resource::(); diff --git a/examples/stress_tests/many_gizmos.rs b/examples/stress_tests/many_gizmos.rs index 472b25d5e4028..f0a72f451e2db 100644 --- a/examples/stress_tests/many_gizmos.rs +++ b/examples/stress_tests/many_gizmos.rs @@ -91,7 +91,10 @@ fn setup(mut commands: Commands) { fn ui_system(mut query: Query<&mut Text>, config: Res, diag: Res) { let mut text = query.single_mut(); - let Some(fps) = diag.get(FrameTimeDiagnosticsPlugin::FPS).and_then(|fps| fps.smoothed()) else { + let Some(fps) = diag + .get(FrameTimeDiagnosticsPlugin::FPS) + .and_then(|fps| fps.smoothed()) + else { return; }; diff --git a/examples/tools/scene_viewer/morph_viewer_plugin.rs b/examples/tools/scene_viewer/morph_viewer_plugin.rs index e71a41db95fbf..b82bef0f20dda 100644 --- a/examples/tools/scene_viewer/morph_viewer_plugin.rs +++ b/examples/tools/scene_viewer/morph_viewer_plugin.rs @@ -181,7 +181,9 @@ fn update_text( mut text: Query<&mut Text>, morphs: Query<&MorphWeights>, ) { - let Some(mut controls) = controls else { return; }; + let Some(mut controls) = controls else { + return; + }; for (i, target) in controls.weights.iter_mut().enumerate() { let Ok(weights) = morphs.get(target.entity) else { continue; @@ -203,7 +205,9 @@ fn update_morphs( input: Res>, time: Res