From fb094eab8793041444294e62df96dd7ae488a980 Mon Sep 17 00:00:00 2001 From: "Ame :]" <104745335+ameknite@users.noreply.github.com> Date: Tue, 29 Aug 2023 19:13:04 -0600 Subject: [PATCH] Move default docs (#9638) # Objective - Make the default docs more useful like suggested in https://github.com/bevyengine/bevy/pull/9600#issuecomment-1696452118 ## Solution - Move the documentation to the `fn default()` method instead of the `impl Default`. Allows you to view the docs directly on the function without having to go to the implementation. ### Before ![Screenshot 2023-08-29 at 18 21 03](https://github.com/bevyengine/bevy/assets/104745335/6d31591e-f190-4b8e-8bc3-a570ada294f0) ### After ![Screenshot 2023-08-29 at 18 19 54](https://github.com/bevyengine/bevy/assets/104745335/e2442ec1-593d-47f3-b539-8c77a170f0b6) --- crates/bevy_ecs/src/schedule/schedule.rs | 8 ++++---- crates/bevy_render/src/view/visibility/render_layers.rs | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/crates/bevy_ecs/src/schedule/schedule.rs b/crates/bevy_ecs/src/schedule/schedule.rs index 0024360158a20..8f7da74f1e78c 100644 --- a/crates/bevy_ecs/src/schedule/schedule.rs +++ b/crates/bevy_ecs/src/schedule/schedule.rs @@ -168,11 +168,11 @@ pub struct Schedule { #[derive(ScheduleLabel, Hash, PartialEq, Eq, Debug, Clone)] struct DefaultSchedule; -/// Creates a schedule with a default label. Only use in situations where -/// where you don't care about the [`ScheduleLabel`]. Inserting a default schedule -/// into the world risks overwriting another schedule. For most situations you should use -/// [`Schedule::new`]. impl Default for Schedule { + /// Creates a schedule with a default label. Only use in situations where + /// you don't care about the [`ScheduleLabel`]. Inserting a default schedule + /// into the world risks overwriting another schedule. For most situations + /// you should use [`Schedule::new`]. fn default() -> Self { Self::new(DefaultSchedule) } diff --git a/crates/bevy_render/src/view/visibility/render_layers.rs b/crates/bevy_render/src/view/visibility/render_layers.rs index 677c0877777ba..0451e35818f15 100644 --- a/crates/bevy_render/src/view/visibility/render_layers.rs +++ b/crates/bevy_render/src/view/visibility/render_layers.rs @@ -38,8 +38,8 @@ impl std::iter::FromIterator for RenderLayers { } } -/// Defaults to containing to layer `0`, the first layer. impl Default for RenderLayers { + /// By default, this structure includes layer `0`, which represents the first layer. fn default() -> Self { RenderLayers::layer(0) }