From 2a823073c4a7c57032a440b10d04ab1fe9fb51bb Mon Sep 17 00:00:00 2001 From: Tristan Guichaoua Date: Fri, 2 Feb 2024 22:10:49 +0100 Subject: [PATCH 01/12] enable missing_docs at workspace level --- Cargo.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/Cargo.toml b/Cargo.toml index e1395480f8c9d..ccf8a1d66ac11 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -42,6 +42,7 @@ map_flatten = "warn" [workspace.lints.rust] unsafe_op_in_unsafe_fn = "warn" +missing_docs = "warn" [lints] workspace = true From 41aa522e02f34743f7df5084ee2c4660de87feb9 Mon Sep 17 00:00:00 2001 From: Tristan Guichaoua Date: Fri, 2 Feb 2024 22:11:08 +0100 Subject: [PATCH 02/12] remove all `#![warn(missing_docs)]` --- crates/bevy_a11y/src/lib.rs | 1 - crates/bevy_animation/src/lib.rs | 2 -- crates/bevy_app/src/lib.rs | 2 -- crates/bevy_audio/src/lib.rs | 1 - crates/bevy_core/src/lib.rs | 2 -- crates/bevy_dylib/src/lib.rs | 1 - crates/bevy_ecs/src/lib.rs | 1 - crates/bevy_gilrs/src/lib.rs | 2 -- crates/bevy_gizmos/src/lib.rs | 2 -- crates/bevy_gltf/src/lib.rs | 2 -- crates/bevy_hierarchy/src/lib.rs | 1 - crates/bevy_input/src/lib.rs | 2 -- crates/bevy_internal/src/lib.rs | 1 - crates/bevy_log/src/lib.rs | 1 - crates/bevy_macro_utils/src/lib.rs | 1 - crates/bevy_math/src/lib.rs | 2 -- crates/bevy_ptr/src/lib.rs | 1 - crates/bevy_reflect/src/path/mod.rs | 2 -- crates/bevy_render/src/mesh/primitives/mod.rs | 2 -- crates/bevy_scene/src/lib.rs | 2 -- crates/bevy_tasks/src/lib.rs | 1 - crates/bevy_time/src/lib.rs | 1 - crates/bevy_transform/src/lib.rs | 1 - crates/bevy_utils/src/lib.rs | 2 -- crates/bevy_window/src/lib.rs | 1 - crates/bevy_winit/src/lib.rs | 1 - crates/bevy_winit/src/winit_windows.rs | 2 -- 27 files changed, 40 deletions(-) diff --git a/crates/bevy_a11y/src/lib.rs b/crates/bevy_a11y/src/lib.rs index 44e4f5cb9031a..53a515c7eeb6d 100644 --- a/crates/bevy_a11y/src/lib.rs +++ b/crates/bevy_a11y/src/lib.rs @@ -1,6 +1,5 @@ //! Accessibility for Bevy -#![warn(missing_docs)] #![forbid(unsafe_code)] use std::sync::{ diff --git a/crates/bevy_animation/src/lib.rs b/crates/bevy_animation/src/lib.rs index 05e6921e0afcd..4cd12f6487c86 100644 --- a/crates/bevy_animation/src/lib.rs +++ b/crates/bevy_animation/src/lib.rs @@ -1,7 +1,5 @@ //! Animation for the game engine Bevy -#![warn(missing_docs)] - use std::ops::{Add, Deref, Mul}; use std::time::Duration; diff --git a/crates/bevy_app/src/lib.rs b/crates/bevy_app/src/lib.rs index dfcd0dc99db1f..8f6ba7972f272 100644 --- a/crates/bevy_app/src/lib.rs +++ b/crates/bevy_app/src/lib.rs @@ -1,7 +1,5 @@ //! This crate is about everything concerning the highest-level, application layer of a Bevy app. -#![warn(missing_docs)] - mod app; mod main_schedule; mod plugin; diff --git a/crates/bevy_audio/src/lib.rs b/crates/bevy_audio/src/lib.rs index ecba57bf0df95..c096877598247 100644 --- a/crates/bevy_audio/src/lib.rs +++ b/crates/bevy_audio/src/lib.rs @@ -21,7 +21,6 @@ //! ``` #![forbid(unsafe_code)] -#![warn(missing_docs)] mod audio; mod audio_output; diff --git a/crates/bevy_core/src/lib.rs b/crates/bevy_core/src/lib.rs index 708b006d7d293..eff6851e30457 100644 --- a/crates/bevy_core/src/lib.rs +++ b/crates/bevy_core/src/lib.rs @@ -1,5 +1,3 @@ -#![warn(missing_docs)] - //! This crate provides core functionality for Bevy Engine. mod name; diff --git a/crates/bevy_dylib/src/lib.rs b/crates/bevy_dylib/src/lib.rs index a950f985d611a..9aefb17ace32f 100644 --- a/crates/bevy_dylib/src/lib.rs +++ b/crates/bevy_dylib/src/lib.rs @@ -1,4 +1,3 @@ -#![warn(missing_docs)] #![allow(clippy::single_component_path_imports)] //! Forces dynamic linking of Bevy. diff --git a/crates/bevy_ecs/src/lib.rs b/crates/bevy_ecs/src/lib.rs index 4f527bfd96389..6b63156d48c65 100644 --- a/crates/bevy_ecs/src/lib.rs +++ b/crates/bevy_ecs/src/lib.rs @@ -1,6 +1,5 @@ // FIXME(11590): remove this once the lint is fixed #![allow(unsafe_op_in_unsafe_fn)] -#![warn(missing_docs)] #![doc = include_str!("../README.md")] #[cfg(target_pointer_width = "16")] diff --git a/crates/bevy_gilrs/src/lib.rs b/crates/bevy_gilrs/src/lib.rs index 46867b73a2f96..b48256b8db826 100644 --- a/crates/bevy_gilrs/src/lib.rs +++ b/crates/bevy_gilrs/src/lib.rs @@ -3,8 +3,6 @@ //! This crate is built on top of [GilRs](gilrs), a library //! that handles abstracting over platform-specific gamepad APIs. -#![warn(missing_docs)] - mod converter; mod gilrs_system; mod rumble; diff --git a/crates/bevy_gizmos/src/lib.rs b/crates/bevy_gizmos/src/lib.rs index 5a4e3599bc651..e782d7b814a33 100644 --- a/crates/bevy_gizmos/src/lib.rs +++ b/crates/bevy_gizmos/src/lib.rs @@ -1,5 +1,3 @@ -#![warn(missing_docs)] - //! This crate adds an immediate mode drawing api to Bevy for visual debugging. //! //! # Example diff --git a/crates/bevy_gltf/src/lib.rs b/crates/bevy_gltf/src/lib.rs index 0e7e882d231f3..5e8d8e3f1cb46 100644 --- a/crates/bevy_gltf/src/lib.rs +++ b/crates/bevy_gltf/src/lib.rs @@ -3,8 +3,6 @@ //! //! The [glTF 2.0 specification](https://registry.khronos.org/glTF/specs/2.0/glTF-2.0.html) defines the format of the glTF files. -#![warn(missing_docs)] - #[cfg(feature = "bevy_animation")] use bevy_animation::AnimationClip; use bevy_utils::HashMap; diff --git a/crates/bevy_hierarchy/src/lib.rs b/crates/bevy_hierarchy/src/lib.rs index da4b33f341bd3..83c0a10569ea3 100644 --- a/crates/bevy_hierarchy/src/lib.rs +++ b/crates/bevy_hierarchy/src/lib.rs @@ -1,4 +1,3 @@ -#![warn(missing_docs)] //! Parent-child relationships for Bevy entities. //! //! You should use the tools in this crate diff --git a/crates/bevy_input/src/lib.rs b/crates/bevy_input/src/lib.rs index d08ed93ce890e..e6841ace81636 100644 --- a/crates/bevy_input/src/lib.rs +++ b/crates/bevy_input/src/lib.rs @@ -1,5 +1,3 @@ -#![warn(missing_docs)] - //! Input functionality for the [Bevy game engine](https://bevyengine.org/). //! //! # Supported input devices diff --git a/crates/bevy_internal/src/lib.rs b/crates/bevy_internal/src/lib.rs index 98dc5eeb3b126..04d364493805c 100644 --- a/crates/bevy_internal/src/lib.rs +++ b/crates/bevy_internal/src/lib.rs @@ -1,4 +1,3 @@ -#![warn(missing_docs)] //! This module is separated into its own crate to enable simple dynamic linking for Bevy, and should not be used directly /// `use bevy::prelude::*;` to import common components, bundles, and plugins. diff --git a/crates/bevy_log/src/lib.rs b/crates/bevy_log/src/lib.rs index b60c154dc64e2..791b156536070 100644 --- a/crates/bevy_log/src/lib.rs +++ b/crates/bevy_log/src/lib.rs @@ -1,4 +1,3 @@ -#![warn(missing_docs)] //! This crate provides logging functions and configuration for [Bevy](https://bevyengine.org) //! apps, and automatically configures platform specific log handlers (i.e. WASM or Android). //! diff --git a/crates/bevy_macro_utils/src/lib.rs b/crates/bevy_macro_utils/src/lib.rs index d14a2c6db7eef..443313f8e87bd 100644 --- a/crates/bevy_macro_utils/src/lib.rs +++ b/crates/bevy_macro_utils/src/lib.rs @@ -1,4 +1,3 @@ -#![warn(missing_docs)] #![deny(unsafe_code)] //! A collection of helper types and functions for working on macros within the Bevy ecosystem. diff --git a/crates/bevy_math/src/lib.rs b/crates/bevy_math/src/lib.rs index 0fd8717964f4b..d4ac8b6158ee3 100644 --- a/crates/bevy_math/src/lib.rs +++ b/crates/bevy_math/src/lib.rs @@ -4,8 +4,6 @@ //! matrices like [`Mat2`], [`Mat3`] and [`Mat4`] and orientation representations //! like [`Quat`]. -#![warn(missing_docs)] - mod affine3; mod aspect_ratio; pub mod bounding; diff --git a/crates/bevy_ptr/src/lib.rs b/crates/bevy_ptr/src/lib.rs index 861219155e252..73a0ab5555b0c 100644 --- a/crates/bevy_ptr/src/lib.rs +++ b/crates/bevy_ptr/src/lib.rs @@ -1,6 +1,5 @@ #![doc = include_str!("../README.md")] #![no_std] -#![warn(missing_docs)] use core::fmt::{self, Formatter, Pointer}; use core::{ diff --git a/crates/bevy_reflect/src/path/mod.rs b/crates/bevy_reflect/src/path/mod.rs index 4f08805a9d60a..ce22d86e5c32f 100644 --- a/crates/bevy_reflect/src/path/mod.rs +++ b/crates/bevy_reflect/src/path/mod.rs @@ -1,5 +1,3 @@ -#![warn(missing_docs)] - pub mod access; pub use access::*; diff --git a/crates/bevy_render/src/mesh/primitives/mod.rs b/crates/bevy_render/src/mesh/primitives/mod.rs index b05b3645cfe18..de9e7f538984c 100644 --- a/crates/bevy_render/src/mesh/primitives/mod.rs +++ b/crates/bevy_render/src/mesh/primitives/mod.rs @@ -19,8 +19,6 @@ //! # } //! ``` -#![warn(missing_docs)] - mod dim2; pub use dim2::{CircleMeshBuilder, EllipseMeshBuilder}; diff --git a/crates/bevy_scene/src/lib.rs b/crates/bevy_scene/src/lib.rs index cb4988c8be8b1..19b18a8f6a912 100644 --- a/crates/bevy_scene/src/lib.rs +++ b/crates/bevy_scene/src/lib.rs @@ -4,8 +4,6 @@ //! instantiated or removed from a world to allow composition. Scenes can be serialized/deserialized, //! for example to save part of the world state to a file. -#![warn(missing_docs)] - mod bundle; mod dynamic_scene; mod dynamic_scene_builder; diff --git a/crates/bevy_tasks/src/lib.rs b/crates/bevy_tasks/src/lib.rs index 7b998c0db3909..69af666d9a545 100644 --- a/crates/bevy_tasks/src/lib.rs +++ b/crates/bevy_tasks/src/lib.rs @@ -1,4 +1,3 @@ -#![warn(missing_docs)] #![doc = include_str!("../README.md")] mod slice; diff --git a/crates/bevy_time/src/lib.rs b/crates/bevy_time/src/lib.rs index 9b7e7a1ea21cc..10beeadad55a9 100644 --- a/crates/bevy_time/src/lib.rs +++ b/crates/bevy_time/src/lib.rs @@ -1,4 +1,3 @@ -#![warn(missing_docs)] #![doc = include_str!("../README.md")] /// Common run conditions diff --git a/crates/bevy_transform/src/lib.rs b/crates/bevy_transform/src/lib.rs index b8c0034355c55..c44c120b0146a 100644 --- a/crates/bevy_transform/src/lib.rs +++ b/crates/bevy_transform/src/lib.rs @@ -1,4 +1,3 @@ -#![warn(missing_docs)] #![doc = include_str!("../README.md")] pub mod commands; diff --git a/crates/bevy_utils/src/lib.rs b/crates/bevy_utils/src/lib.rs index 37a8380e4d06a..b70ee02ebe4bc 100644 --- a/crates/bevy_utils/src/lib.rs +++ b/crates/bevy_utils/src/lib.rs @@ -3,8 +3,6 @@ //! [Bevy]: https://bevyengine.org/ //! -#![warn(missing_docs)] - #[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 ae83d4f5016b9..0c7eb48e8dc50 100644 --- a/crates/bevy_window/src/lib.rs +++ b/crates/bevy_window/src/lib.rs @@ -1,4 +1,3 @@ -#![warn(missing_docs)] //! `bevy_window` provides a platform-agnostic interface for windowing in Bevy. //! //! This crate contains types for window management and events, diff --git a/crates/bevy_winit/src/lib.rs b/crates/bevy_winit/src/lib.rs index 63d79b1d23d23..2ea7736d1c75f 100644 --- a/crates/bevy_winit/src/lib.rs +++ b/crates/bevy_winit/src/lib.rs @@ -1,4 +1,3 @@ -#![warn(missing_docs)] //! `bevy_winit` provides utilities to handle window creation and the eventloop through [`winit`] //! //! Most commonly, the [`WinitPlugin`] is used as part of diff --git a/crates/bevy_winit/src/winit_windows.rs b/crates/bevy_winit/src/winit_windows.rs index be7b3ffac2f02..484a7669f4a23 100644 --- a/crates/bevy_winit/src/winit_windows.rs +++ b/crates/bevy_winit/src/winit_windows.rs @@ -1,5 +1,3 @@ -#![warn(missing_docs)] - use accesskit_winit::Adapter; use bevy_a11y::{ accesskit::{NodeBuilder, NodeClassSet, NodeId, Role, Tree, TreeUpdate}, From af265b17af5feaeec1f0e39d3f50da714eae28e7 Mon Sep 17 00:00:00 2001 From: Tristan Guichaoua Date: Fri, 2 Feb 2024 22:22:57 +0100 Subject: [PATCH 03/12] mark allow(missing_docs) for crate with incomplete docs --- crates/bevy_asset/macros/src/lib.rs | 3 +++ crates/bevy_asset/src/lib.rs | 3 +++ crates/bevy_core_pipeline/src/lib.rs | 3 +++ crates/bevy_derive/src/lib.rs | 3 +++ crates/bevy_diagnostic/src/lib.rs | 3 +++ crates/bevy_dynamic_plugin/src/lib.rs | 2 ++ crates/bevy_ecs/macros/src/lib.rs | 3 +++ crates/bevy_encase_derive/src/lib.rs | 3 +++ crates/bevy_mikktspace/src/lib.rs | 2 ++ crates/bevy_reflect/src/lib.rs | 3 +++ crates/bevy_render/macros/src/lib.rs | 3 +++ crates/bevy_utils/macros/src/lib.rs | 3 +++ 12 files changed, 34 insertions(+) diff --git a/crates/bevy_asset/macros/src/lib.rs b/crates/bevy_asset/macros/src/lib.rs index 952cf8d7d7aec..a24a7525683a6 100644 --- a/crates/bevy_asset/macros/src/lib.rs +++ b/crates/bevy_asset/macros/src/lib.rs @@ -1,3 +1,6 @@ +// FIXME(3492): remove once docs is ready +#![allow(missing_docs)] + use bevy_macro_utils::BevyManifest; use proc_macro::{Span, TokenStream}; use quote::{format_ident, quote}; diff --git a/crates/bevy_asset/src/lib.rs b/crates/bevy_asset/src/lib.rs index 49703ff3ece21..b84c8e2ba7a3c 100644 --- a/crates/bevy_asset/src/lib.rs +++ b/crates/bevy_asset/src/lib.rs @@ -1,3 +1,6 @@ +// FIXME(3492): remove once docs is ready +#![allow(missing_docs)] + pub mod io; pub mod meta; pub mod processor; diff --git a/crates/bevy_core_pipeline/src/lib.rs b/crates/bevy_core_pipeline/src/lib.rs index 5aad6703eda56..ae854f0577295 100644 --- a/crates/bevy_core_pipeline/src/lib.rs +++ b/crates/bevy_core_pipeline/src/lib.rs @@ -1,3 +1,6 @@ +// FIXME(3492): remove once docs is ready +#![allow(missing_docs)] + pub mod blit; pub mod bloom; pub mod contrast_adaptive_sharpening; diff --git a/crates/bevy_derive/src/lib.rs b/crates/bevy_derive/src/lib.rs index 18d61262ee0fd..c7efdbea8b2a4 100644 --- a/crates/bevy_derive/src/lib.rs +++ b/crates/bevy_derive/src/lib.rs @@ -1,3 +1,6 @@ +// FIXME(3492): remove once docs is ready +#![allow(missing_docs)] + extern crate proc_macro; mod app_plugin; diff --git a/crates/bevy_diagnostic/src/lib.rs b/crates/bevy_diagnostic/src/lib.rs index e16360a2d4962..32a67ffcc1db6 100644 --- a/crates/bevy_diagnostic/src/lib.rs +++ b/crates/bevy_diagnostic/src/lib.rs @@ -1,3 +1,6 @@ +// FIXME(3492): remove once docs is ready +#![allow(missing_docs)] + //! This crate provides a straightforward solution for integrating diagnostics in the [Bevy game engine](https://bevyengine.org/). //! It allows users to easily add diagnostic functionality to their Bevy applications, enhancing //! their ability to monitor and optimize their game's. diff --git a/crates/bevy_dynamic_plugin/src/lib.rs b/crates/bevy_dynamic_plugin/src/lib.rs index 76a593de45d3b..14ec23187c958 100644 --- a/crates/bevy_dynamic_plugin/src/lib.rs +++ b/crates/bevy_dynamic_plugin/src/lib.rs @@ -1,5 +1,7 @@ // FIXME(11590): remove this once the lint is fixed #![allow(unsafe_op_in_unsafe_fn)] +// FIXME(3492): remove once docs is ready +#![allow(missing_docs)] mod loader; diff --git a/crates/bevy_ecs/macros/src/lib.rs b/crates/bevy_ecs/macros/src/lib.rs index f9d3f0314ba02..e553879fef325 100644 --- a/crates/bevy_ecs/macros/src/lib.rs +++ b/crates/bevy_ecs/macros/src/lib.rs @@ -1,3 +1,6 @@ +// FIXME(3492): remove once docs is ready +#![allow(missing_docs)] + extern crate proc_macro; mod component; diff --git a/crates/bevy_encase_derive/src/lib.rs b/crates/bevy_encase_derive/src/lib.rs index d57be9f85c7c5..eed784e431a7f 100644 --- a/crates/bevy_encase_derive/src/lib.rs +++ b/crates/bevy_encase_derive/src/lib.rs @@ -1,3 +1,6 @@ +// FIXME(3492): remove once docs is ready +#![allow(missing_docs)] + use bevy_macro_utils::BevyManifest; use encase_derive_impl::{implement, syn}; diff --git a/crates/bevy_mikktspace/src/lib.rs b/crates/bevy_mikktspace/src/lib.rs index 50cf1ea7d5c57..85a5b46933756 100644 --- a/crates/bevy_mikktspace/src/lib.rs +++ b/crates/bevy_mikktspace/src/lib.rs @@ -3,6 +3,8 @@ clippy::all, clippy::undocumented_unsafe_blocks )] +// FIXME(3492): remove once docs is ready +#![allow(missing_docs)] use glam::{Vec2, Vec3}; diff --git a/crates/bevy_reflect/src/lib.rs b/crates/bevy_reflect/src/lib.rs index 9447cd41a6701..6558ee4cd6c0d 100644 --- a/crates/bevy_reflect/src/lib.rs +++ b/crates/bevy_reflect/src/lib.rs @@ -1,3 +1,6 @@ +// FIXME(3492): remove once docs is ready +#![allow(missing_docs)] + //! Reflection in Rust. //! //! [Reflection] is a powerful tool provided within many programming languages diff --git a/crates/bevy_render/macros/src/lib.rs b/crates/bevy_render/macros/src/lib.rs index c0d04e6c776a3..776c82e4715e2 100644 --- a/crates/bevy_render/macros/src/lib.rs +++ b/crates/bevy_render/macros/src/lib.rs @@ -1,3 +1,6 @@ +// FIXME(3492): remove once docs is ready +#![allow(missing_docs)] + mod as_bind_group; mod extract_component; mod extract_resource; diff --git a/crates/bevy_utils/macros/src/lib.rs b/crates/bevy_utils/macros/src/lib.rs index 4189b432ac605..5bd949d133dbf 100644 --- a/crates/bevy_utils/macros/src/lib.rs +++ b/crates/bevy_utils/macros/src/lib.rs @@ -1,3 +1,6 @@ +// FIXME(3492): remove once docs is ready +#![allow(missing_docs)] + use proc_macro::TokenStream; use quote::{format_ident, quote}; use syn::{ From 6e0d0274d9751af09c6ff7713e70743c768ee955 Mon Sep 17 00:00:00 2001 From: Tristan Guichaoua Date: Fri, 2 Feb 2024 22:43:03 +0100 Subject: [PATCH 04/12] fix some examples missing_docs --- crates/bevy_ecs/examples/change_detection.rs | 15 ++++++++------- crates/bevy_ecs/examples/events.rs | 5 +++-- crates/bevy_ecs/examples/resources.rs | 5 +++-- crates/bevy_mikktspace/examples/generate.rs | 4 +++- crates/bevy_tasks/examples/busy_behavior.rs | 8 ++++---- crates/bevy_tasks/examples/idle_behavior.rs | 8 ++++---- examples/3d/generate_custom_mesh.rs | 7 ++++--- examples/3d/spotlight.rs | 2 ++ examples/hello_world.rs | 2 ++ examples/mobile/src/lib.rs | 2 ++ examples/shader/array_texture.rs | 5 +++-- examples/stress_tests/many_buttons.rs | 3 ++- examples/stress_tests/many_gizmos.rs | 2 ++ examples/time/time.rs | 2 ++ 14 files changed, 44 insertions(+), 26 deletions(-) diff --git a/crates/bevy_ecs/examples/change_detection.rs b/crates/bevy_ecs/examples/change_detection.rs index 8bfa18d735f6d..0f49c5e709f7d 100644 --- a/crates/bevy_ecs/examples/change_detection.rs +++ b/crates/bevy_ecs/examples/change_detection.rs @@ -1,14 +1,15 @@ +//! In this example we will simulate a population of entities. In every tick we will: +//! 1. spawn a new entity with a certain possibility +//! 2. age all entities +//! 3. despawn entities with age > 2 +//! +//! To demonstrate change detection, there are some console outputs based on changes in +//! the `EntityCounter` resource and updated Age components + use bevy_ecs::prelude::*; use rand::Rng; use std::ops::Deref; -// In this example we will simulate a population of entities. In every tick we will: -// 1. spawn a new entity with a certain possibility -// 2. age all entities -// 3. despawn entities with age > 2 -// -// To demonstrate change detection, there are some console outputs based on changes in -// the EntityCounter resource and updated Age components fn main() { // Create a new empty World to hold our Entities, Components and Resources let mut world = World::new(); diff --git a/crates/bevy_ecs/examples/events.rs b/crates/bevy_ecs/examples/events.rs index 7be6795880775..f75ca81b50b5f 100644 --- a/crates/bevy_ecs/examples/events.rs +++ b/crates/bevy_ecs/examples/events.rs @@ -1,7 +1,8 @@ +//! In this example a system sends a custom event with a 50/50 chance during any frame. +//! If an event was send, it will be printed by the console in a receiving system. + use bevy_ecs::prelude::*; -// In this example a system sends a custom event with a 50/50 chance during any frame. -// If an event was send, it will be printed by the console in a receiving system. fn main() { // Create a new empty world and add the event as a resource let mut world = World::new(); diff --git a/crates/bevy_ecs/examples/resources.rs b/crates/bevy_ecs/examples/resources.rs index b1f170ef9d619..e8d6a9bc10cce 100644 --- a/crates/bevy_ecs/examples/resources.rs +++ b/crates/bevy_ecs/examples/resources.rs @@ -1,9 +1,10 @@ +//! In this example we add a counter resource and increase it's value in one system, +//! while a different system prints the current count to the console. + use bevy_ecs::prelude::*; use rand::Rng; use std::ops::Deref; -// In this example we add a counter resource and increase it's value in one system, -// while a different system prints the current count to the console. fn main() { // Create a world let mut world = World::new(); diff --git a/crates/bevy_mikktspace/examples/generate.rs b/crates/bevy_mikktspace/examples/generate.rs index a8cefb8809ff4..6ca3fa36df06e 100644 --- a/crates/bevy_mikktspace/examples/generate.rs +++ b/crates/bevy_mikktspace/examples/generate.rs @@ -1,8 +1,10 @@ +//! This example demonstrates how to generate a mesh. + #![allow(clippy::bool_assert_comparison, clippy::useless_conversion)] use glam::{Vec2, Vec3}; -pub type Face = [u32; 3]; +type Face = [u32; 3]; #[derive(Debug)] struct Vertex { diff --git a/crates/bevy_tasks/examples/busy_behavior.rs b/crates/bevy_tasks/examples/busy_behavior.rs index 23a43de017a59..ee92ec359382c 100644 --- a/crates/bevy_tasks/examples/busy_behavior.rs +++ b/crates/bevy_tasks/examples/busy_behavior.rs @@ -1,10 +1,10 @@ +//! This sample demonstrates creating a thread pool with 4 tasks and spawning 40 tasks that spin +//! for 100ms. It's expected to take about a second to run (assuming the machine has >= 4 logical +//! cores) + use bevy_tasks::TaskPoolBuilder; use web_time::{Duration, Instant}; -// This sample demonstrates creating a thread pool with 4 tasks and spawning 40 tasks that spin -// for 100ms. It's expected to take about a second to run (assuming the machine has >= 4 logical -// cores) - fn main() { let pool = TaskPoolBuilder::new() .thread_name("Busy Behavior ThreadPool".to_string()) diff --git a/crates/bevy_tasks/examples/idle_behavior.rs b/crates/bevy_tasks/examples/idle_behavior.rs index 3ce121f989fc3..2887163170875 100644 --- a/crates/bevy_tasks/examples/idle_behavior.rs +++ b/crates/bevy_tasks/examples/idle_behavior.rs @@ -1,10 +1,10 @@ +//! This sample demonstrates a thread pool with one thread per logical core and only one task +//! spinning. Other than the one thread, the system should remain idle, demonstrating good behavior +//! for small workloads. + use bevy_tasks::TaskPoolBuilder; use web_time::{Duration, Instant}; -// This sample demonstrates a thread pool with one thread per logical core and only one task -// spinning. Other than the one thread, the system should remain idle, demonstrating good behavior -// for small workloads. - fn main() { let pool = TaskPoolBuilder::new() .thread_name("Idle Behavior ThreadPool".to_string()) diff --git a/examples/3d/generate_custom_mesh.rs b/examples/3d/generate_custom_mesh.rs index 3169b897e76aa..1c9cf0d067e90 100644 --- a/examples/3d/generate_custom_mesh.rs +++ b/examples/3d/generate_custom_mesh.rs @@ -1,6 +1,7 @@ -// ! This example demonstrates how to create a custom mesh, -// ! assign a custom UV mapping for a custom texture, -// ! and how to change the UV mapping at run-time. +//! This example demonstrates how to create a custom mesh, +//! assign a custom UV mapping for a custom texture, +//! and how to change the UV mapping at run-time. + use bevy::prelude::*; use bevy::render::{ mesh::{Indices, VertexAttributeValues}, diff --git a/examples/3d/spotlight.rs b/examples/3d/spotlight.rs index 533dc9dd2b817..93cdd3ea6668f 100644 --- a/examples/3d/spotlight.rs +++ b/examples/3d/spotlight.rs @@ -1,3 +1,5 @@ +//! Illustrates spot lights. + use std::f32::consts::*; use bevy::{ diff --git a/examples/hello_world.rs b/examples/hello_world.rs index 9b5dc363de5b4..40f55c10c31bb 100644 --- a/examples/hello_world.rs +++ b/examples/hello_world.rs @@ -1,3 +1,5 @@ +//! A minimal example that outputs "hello world" + use bevy::prelude::*; fn main() { diff --git a/examples/mobile/src/lib.rs b/examples/mobile/src/lib.rs index 0194a0f556b35..2dd4091580c6b 100644 --- a/examples/mobile/src/lib.rs +++ b/examples/mobile/src/lib.rs @@ -1,3 +1,5 @@ +//! A 3d Scene with a button and playing sound. + use bevy::{ input::touch::TouchPhase, prelude::*, diff --git a/examples/shader/array_texture.rs b/examples/shader/array_texture.rs index 2ba2bac546279..81bb57b890d8f 100644 --- a/examples/shader/array_texture.rs +++ b/examples/shader/array_texture.rs @@ -1,3 +1,6 @@ +//! This example illustrates how to create a texture for use with a `texture_2d_array` shader +//! uniform variable. + use bevy::{ asset::LoadState, prelude::*, @@ -5,8 +8,6 @@ use bevy::{ render::render_resource::{AsBindGroup, ShaderRef}, }; -/// This example illustrates how to create a texture for use with a `texture_2d_array` shader -/// uniform variable. fn main() { App::new() .add_plugins(( diff --git a/examples/stress_tests/many_buttons.rs b/examples/stress_tests/many_buttons.rs index 859ef8eed97dd..01df28aef6116 100644 --- a/examples/stress_tests/many_buttons.rs +++ b/examples/stress_tests/many_buttons.rs @@ -1,4 +1,5 @@ -/// General UI benchmark that stress tests layouting, text, interaction and rendering +//! General UI benchmark that stress tests layouting, text, interaction and rendering + use argh::FromArgs; use bevy::{ diagnostic::{FrameTimeDiagnosticsPlugin, LogDiagnosticsPlugin}, diff --git a/examples/stress_tests/many_gizmos.rs b/examples/stress_tests/many_gizmos.rs index b15a519610486..88ba0aeaa5fed 100644 --- a/examples/stress_tests/many_gizmos.rs +++ b/examples/stress_tests/many_gizmos.rs @@ -1,3 +1,5 @@ +//! Test rendering of many gizmos. + use std::f32::consts::TAU; use bevy::{ diff --git a/examples/time/time.rs b/examples/time/time.rs index e0c1d6e427b0a..01e5eefa1b07b 100644 --- a/examples/time/time.rs +++ b/examples/time/time.rs @@ -1,3 +1,5 @@ +//! An example that illustrates how Time is handled in ECS. + use bevy::prelude::*; use std::io::{self, BufRead}; From 6e1bc48158c43249d6c70758b4a0f0ce371e1d5e Mon Sep 17 00:00:00 2001 From: Tristan Guichaoua Date: Sat, 3 Feb 2024 11:45:49 +0100 Subject: [PATCH 05/12] add more `#![allow(missing_docs)]` --- crates/bevy_pbr/src/lib.rs | 3 +++ crates/bevy_render/src/lib.rs | 3 +++ crates/bevy_sprite/src/lib.rs | 3 +++ crates/bevy_text/src/lib.rs | 3 +++ crates/bevy_ui/src/lib.rs | 3 +++ 5 files changed, 15 insertions(+) diff --git a/crates/bevy_pbr/src/lib.rs b/crates/bevy_pbr/src/lib.rs index c1556c8d360d1..589c238cbc905 100644 --- a/crates/bevy_pbr/src/lib.rs +++ b/crates/bevy_pbr/src/lib.rs @@ -1,3 +1,6 @@ +// FIXME(3492): remove once docs is ready +#![allow(missing_docs)] + pub mod wireframe; mod alpha; diff --git a/crates/bevy_render/src/lib.rs b/crates/bevy_render/src/lib.rs index 656ba9e12aa6a..78a0732c3cb11 100644 --- a/crates/bevy_render/src/lib.rs +++ b/crates/bevy_render/src/lib.rs @@ -1,3 +1,6 @@ +// FIXME(3492): remove once docs is ready +#![allow(missing_docs)] + #[cfg(target_pointer_width = "16")] compile_error!("bevy_render cannot compile for a 16-bit platform."); diff --git a/crates/bevy_sprite/src/lib.rs b/crates/bevy_sprite/src/lib.rs index 9c085149e610e..6ed6e788df138 100644 --- a/crates/bevy_sprite/src/lib.rs +++ b/crates/bevy_sprite/src/lib.rs @@ -1,3 +1,6 @@ +// FIXME(3492): remove once docs is ready +#![allow(missing_docs)] + //! Provides 2D sprite rendering functionality. mod bundle; mod dynamic_texture_atlas_builder; diff --git a/crates/bevy_text/src/lib.rs b/crates/bevy_text/src/lib.rs index d0b5752266f55..ba0cb0395d891 100644 --- a/crates/bevy_text/src/lib.rs +++ b/crates/bevy_text/src/lib.rs @@ -1,3 +1,6 @@ +// FIXME(3492): remove once docs is ready +#![allow(missing_docs)] + mod error; mod font; mod font_atlas; diff --git a/crates/bevy_ui/src/lib.rs b/crates/bevy_ui/src/lib.rs index 8bb1bd20a5b06..dcd71208556ee 100644 --- a/crates/bevy_ui/src/lib.rs +++ b/crates/bevy_ui/src/lib.rs @@ -1,3 +1,6 @@ +// FIXME(3492): remove once docs is ready +#![allow(missing_docs)] + //! This crate contains Bevy's UI system, which can be used to create UI for both 2D and 3D games //! # Basic usage //! Spawn UI elements with [`node_bundles::ButtonBundle`], [`node_bundles::ImageBundle`], [`node_bundles::TextBundle`] and [`node_bundles::NodeBundle`] From de8962d9506f315b92dcc4533352f173a935cb48 Mon Sep 17 00:00:00 2001 From: Tristan Guichaoua Date: Sat, 3 Feb 2024 12:03:36 +0100 Subject: [PATCH 06/12] fix missing_docs for examples --- examples/3d/lines.rs | 8 ++++---- examples/3d/tonemapping.rs | 2 +- examples/animation/cubic_curve.rs | 7 ++----- examples/app/plugin.rs | 2 +- examples/app/plugin_group.rs | 4 ++-- examples/asset/asset_decompression.rs | 6 +++--- examples/asset/custom_asset.rs | 13 +++++++------ examples/diagnostics/custom_diagnostic.rs | 3 +-- examples/ecs/system_param.rs | 4 ++-- examples/reflection/reflection.rs | 2 +- examples/reflection/reflection_types.rs | 4 ++-- examples/reflection/trait_reflection.rs | 2 +- examples/shader/compute_shader_game_of_life.rs | 6 +++--- examples/shader/custom_vertex_attribute.rs | 2 +- examples/shader/post_processing.rs | 2 +- examples/shader/shader_defs.rs | 4 ++-- examples/shader/shader_instancing.rs | 8 ++++---- examples/shader/shader_material.rs | 2 +- examples/shader/shader_material_2d.rs | 2 +- .../shader/shader_material_screenspace_texture.rs | 2 +- examples/shader/shader_prepass.rs | 4 ++-- examples/time/timers.rs | 8 ++++---- 22 files changed, 47 insertions(+), 50 deletions(-) diff --git a/examples/3d/lines.rs b/examples/3d/lines.rs index 5be486169561d..fa6158aa70259 100644 --- a/examples/3d/lines.rs +++ b/examples/3d/lines.rs @@ -87,8 +87,8 @@ impl Material for LineMaterial { /// A list of lines with a start and end position #[derive(Debug, Clone)] -pub struct LineList { - pub lines: Vec<(Vec3, Vec3)>, +struct LineList { + lines: Vec<(Vec3, Vec3)>, } impl From for Mesh { @@ -108,8 +108,8 @@ impl From for Mesh { /// A list of points that will have a line drawn between each consecutive points #[derive(Debug, Clone)] -pub struct LineStrip { - pub points: Vec, +struct LineStrip { + points: Vec, } impl From for Mesh { diff --git a/examples/3d/tonemapping.rs b/examples/3d/tonemapping.rs index db4d4a9e23067..9c168415b8de6 100644 --- a/examples/3d/tonemapping.rs +++ b/examples/3d/tonemapping.rs @@ -704,7 +704,7 @@ impl Material for ColorGradientMaterial { } #[derive(Asset, TypePath, AsBindGroup, Debug, Clone)] -pub struct ColorGradientMaterial {} +struct ColorGradientMaterial {} #[derive(Resource)] struct CameraTransform(Transform); diff --git a/examples/animation/cubic_curve.rs b/examples/animation/cubic_curve.rs index 9b20b51618119..fc440b49a992f 100644 --- a/examples/animation/cubic_curve.rs +++ b/examples/animation/cubic_curve.rs @@ -5,6 +5,7 @@ use bevy::{ prelude::*, }; +/// The curve used to animate the cube. #[derive(Component)] pub struct Curve(CubicCurve); @@ -72,11 +73,7 @@ fn setup( }); } -pub fn animate_cube( - time: Res