Skip to content

Commit 6ec6a55

Browse files
BD103MrGVSV
andauthored
Unify crate-level preludes (#15080)
# Objective - Crate-level prelude modules, such as `bevy_ecs::prelude`, are plagued with inconsistency! Let's fix it! ## Solution Format all preludes based on the following rules: 1. All preludes should have brief documentation in the format of: > The _name_ prelude. > > This includes the most common types in this crate, re-exported for your convenience. 2. All documentation should be outer, not inner. (`///` instead of `//!`.) 3. No prelude modules should be annotated with `#[doc(hidden)]`. (Items within them may, though I'm not sure why this was done.) ## Testing - I manually searched for the term `mod prelude` and updated all occurrences by hand. 🫠 --------- Co-authored-by: Gino Valente <[email protected]>
1 parent b738f08 commit 6ec6a55

File tree

30 files changed

+91
-24
lines changed

30 files changed

+91
-24
lines changed

crates/bevy_animation/src/lib.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@ use serde::{Deserialize, Serialize};
3939
use thread_local::ThreadLocal;
4040
use uuid::Uuid;
4141

42-
#[allow(missing_docs)]
42+
/// The animation prelude.
43+
///
44+
/// This includes the most common types in this crate, re-exported for your convenience.
4345
pub mod prelude {
4446
#[doc(hidden)]
4547
pub use crate::{

crates/bevy_app/src/lib.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ pub use sub_app::*;
2727
#[cfg(not(target_arch = "wasm32"))]
2828
pub use terminal_ctrl_c_handler::*;
2929

30-
#[allow(missing_docs)]
30+
/// The app prelude.
31+
///
32+
/// This includes the most common types in this crate, re-exported for your convenience.
3133
pub mod prelude {
3234
#[doc(hidden)]
3335
pub use crate::{

crates/bevy_asset/src/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ pub mod processor;
1212
pub mod saver;
1313
pub mod transformer;
1414

15+
/// The asset prelude.
16+
///
17+
/// This includes the most common types in this crate, re-exported for your convenience.
1518
pub mod prelude {
1619
#[doc(hidden)]
1720
pub use crate::{

crates/bevy_audio/src/lib.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@ mod audio_source;
3333
mod pitch;
3434
mod sinks;
3535

36-
#[allow(missing_docs)]
36+
/// The audio prelude.
37+
///
38+
/// This includes the most common types in this crate, re-exported for your convenience.
3739
pub mod prelude {
3840
#[doc(hidden)]
3941
pub use crate::{

crates/bevy_color/src/lib.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,9 @@ mod test_colors;
111111
mod testing;
112112
mod xyza;
113113

114-
/// Commonly used color types and traits.
114+
/// The color prelude.
115+
///
116+
/// This includes the most common types in this crate, re-exported for your convenience.
115117
pub mod prelude {
116118
pub use crate::color::*;
117119
pub use crate::color_ops::*;

crates/bevy_core/src/lib.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,10 @@ use bevy_ecs::system::Resource;
1616
pub use name::*;
1717
pub use task_pool_options::*;
1818

19+
/// The core prelude.
20+
///
21+
/// This includes the most common types in this crate, re-exported for your convenience.
1922
pub mod prelude {
20-
//! The Bevy Core Prelude.
2123
#[doc(hidden)]
2224
pub use crate::{
2325
FrameCountPlugin, Name, NameOrEntity, TaskPoolOptions, TaskPoolPlugin,

crates/bevy_core_pipeline/src/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ pub mod experimental {
4141
}
4242
}
4343

44+
/// The core pipeline prelude.
45+
///
46+
/// This includes the most common types in this crate, re-exported for your convenience.
4447
pub mod prelude {
4548
#[doc(hidden)]
4649
pub use crate::{

crates/bevy_ecs/src/lib.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@ pub mod world;
3636

3737
pub use bevy_ptr as ptr;
3838

39-
/// Most commonly used re-exported types.
39+
/// The ECS prelude.
40+
///
41+
/// This includes the most common types in this crate, re-exported for your convenience.
4042
pub mod prelude {
4143
#[doc(hidden)]
4244
#[cfg(feature = "reflect_functions")]

crates/bevy_gizmos/src/lib.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,9 @@ mod pipeline_2d;
5151
#[cfg(all(feature = "bevy_pbr", feature = "bevy_render"))]
5252
mod pipeline_3d;
5353

54-
/// The `bevy_gizmos` prelude.
54+
/// The gizmos prelude.
55+
///
56+
/// This includes the most common types in this crate, re-exported for your convenience.
5557
pub mod prelude {
5658
#[cfg(feature = "bevy_render")]
5759
pub use crate::aabb::{AabbGizmoConfigGroup, ShowAabbGizmo};

crates/bevy_gltf/src/lib.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,9 @@ use bevy_render::{
115115
};
116116
use bevy_scene::Scene;
117117

118-
/// The `bevy_gltf` prelude.
118+
/// The glTF prelude.
119+
///
120+
/// This includes the most common types in this crate, re-exported for your convenience.
119121
pub mod prelude {
120122
#[doc(hidden)]
121123
pub use crate::{Gltf, GltfAssetLabel, GltfExtras};

crates/bevy_hierarchy/src/lib.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,9 @@ pub use valid_parent_check_plugin::*;
6969
mod query_extension;
7070
pub use query_extension::*;
7171

72-
#[doc(hidden)]
72+
/// The hierarchy prelude.
73+
///
74+
/// This includes the most common types in this crate, re-exported for your convenience.
7375
pub mod prelude {
7476
#[doc(hidden)]
7577
pub use crate::{child_builder::*, components::*, hierarchy::*, query_extension::*};

crates/bevy_input/src/lib.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ pub mod touch;
2424
pub use axis::*;
2525
pub use button_input::*;
2626

27-
/// Most commonly used re-exported types.
27+
/// The input prelude.
28+
///
29+
/// This includes the most common types in this crate, re-exported for your convenience.
2830
pub mod prelude {
2931
#[doc(hidden)]
3032
pub use crate::{

crates/bevy_log/src/lib.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,10 @@ mod android_tracing;
2828
static GLOBAL: tracy_client::ProfiledAllocator<std::alloc::System> =
2929
tracy_client::ProfiledAllocator::new(std::alloc::System, 100);
3030

31+
/// The log prelude.
32+
///
33+
/// This includes the most common types in this crate, re-exported for your convenience.
3134
pub mod prelude {
32-
//! The Bevy Log Prelude.
3335
#[doc(hidden)]
3436
pub use bevy_utils::tracing::{
3537
debug, debug_span, error, error_span, info, info_span, trace, trace_span, warn, warn_span,

crates/bevy_math/src/lib.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,9 @@ pub use rotation2d::Rot2;
4343
#[cfg(feature = "rand")]
4444
pub use sampling::{FromRng, ShapeSample};
4545

46-
/// The `bevy_math` prelude.
46+
/// The math prelude.
47+
///
48+
/// This includes the most common types in this crate, re-exported for your convenience.
4749
pub mod prelude {
4850
#[doc(hidden)]
4951
#[cfg(feature = "rand")]

crates/bevy_pbr/src/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,9 @@ pub use volumetric_fog::{
6161
FogVolume, FogVolumeBundle, VolumetricFogPlugin, VolumetricFogSettings, VolumetricLight,
6262
};
6363

64+
/// The PBR prelude.
65+
///
66+
/// This includes the most common types in this crate, re-exported for your convenience.
6467
pub mod prelude {
6568
#[doc(hidden)]
6669
pub use crate::{

crates/bevy_picking/src/backend.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@ use bevy_ecs::prelude::*;
3535
use bevy_math::Vec3;
3636
use bevy_reflect::Reflect;
3737

38-
/// Common imports for implementing a picking backend.
38+
/// The picking backend prelude.
39+
///
40+
/// This includes the most common types in this module, re-exported for your convenience.
3941
pub mod prelude {
4042
pub use super::{ray::RayMap, HitData, PointerHits};
4143
pub use crate::{

crates/bevy_picking/src/input.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@ use crate::{
2929

3030
use crate::PickSet;
3131

32-
/// Common imports for `bevy_picking`.
32+
/// The picking input prelude.
33+
///
34+
/// This includes the most common types in this module, re-exported for your convenience.
3335
pub mod prelude {
3436
pub use crate::input::PointerInputPlugin;
3537
}

crates/bevy_picking/src/lib.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,9 @@ use bevy_app::prelude::*;
160160
use bevy_ecs::prelude::*;
161161
use bevy_reflect::prelude::*;
162162

163-
/// common exports for picking interaction
163+
/// The picking prelude.
164+
///
165+
/// This includes the most common types in this crate, re-exported for your convenience.
164166
pub mod prelude {
165167
#[doc(hidden)]
166168
pub use crate::{

crates/bevy_reflect/src/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -564,6 +564,9 @@ pub mod serde;
564564
pub mod std_traits;
565565
pub mod utility;
566566

567+
/// The reflect prelude.
568+
///
569+
/// This includes the most common types in this crate, re-exported for your convenience.
567570
pub mod prelude {
568571
pub use crate::std_traits::*;
569572
#[doc(hidden)]

crates/bevy_render/src/lib.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ mod spatial_bundle;
3838
pub mod storage;
3939
pub mod texture;
4040
pub mod view;
41+
42+
/// The render prelude.
43+
///
44+
/// This includes the most common types in this crate, re-exported for your convenience.
4145
pub mod prelude {
4246
#[doc(hidden)]
4347
pub use crate::{

crates/bevy_scene/src/lib.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,9 @@ pub use scene_filter::*;
3434
pub use scene_loader::*;
3535
pub use scene_spawner::*;
3636

37-
#[allow(missing_docs)]
37+
/// The scene prelude.
38+
///
39+
/// This includes the most common types in this crate, re-exported for your convenience.
3840
pub mod prelude {
3941
#[doc(hidden)]
4042
pub use crate::{

crates/bevy_sprite/src/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ mod texture_atlas;
1919
mod texture_atlas_builder;
2020
mod texture_slice;
2121

22+
/// The sprite prelude.
23+
///
24+
/// This includes the most common types in this crate, re-exported for your convenience.
2225
pub mod prelude {
2326
#[allow(deprecated)]
2427
#[doc(hidden)]

crates/bevy_state/src/lib.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,9 @@ pub mod state_scoped;
4747
/// Provides definitions for the basic traits required by the state system
4848
pub mod reflect;
4949

50-
/// Most commonly used re-exported types.
50+
/// The state prelude.
51+
///
52+
/// This includes the most common types in this crate, re-exported for your convenience.
5153
pub mod prelude {
5254
#[cfg(feature = "bevy_app")]
5355
#[doc(hidden)]

crates/bevy_tasks/src/lib.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,9 @@ pub use iter::ParallelIterator;
4444

4545
pub use futures_lite;
4646

47-
#[allow(missing_docs)]
47+
/// The tasks prelude.
48+
///
49+
/// This includes the most common types in this crate, re-exported for your convenience.
4850
pub mod prelude {
4951
#[doc(hidden)]
5052
pub use crate::{

crates/bevy_text/src/lib.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,9 @@ pub use pipeline::*;
5555
pub use text::*;
5656
pub use text2d::*;
5757

58-
/// Most commonly used re-exported types.
58+
/// The text prelude.
59+
///
60+
/// This includes the most common types in this crate, re-exported for your convenience.
5961
pub mod prelude {
6062
#[doc(hidden)]
6163
pub use crate::{Font, JustifyText, Text, Text2dBundle, TextError, TextSection, TextStyle};

crates/bevy_time/src/lib.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,10 @@ pub use time::*;
2323
pub use timer::*;
2424
pub use virt::*;
2525

26+
/// The time prelude.
27+
///
28+
/// This includes the most common types in this crate, re-exported for your convenience.
2629
pub mod prelude {
27-
//! The Bevy Time Prelude.
2830
#[doc(hidden)]
2931
pub use crate::{Fixed, Real, Time, Timer, TimerMode, Virtual};
3032
}

crates/bevy_transform/src/lib.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@ pub mod helper;
2929
#[cfg(feature = "bevy-support")]
3030
pub mod systems;
3131

32-
#[doc(hidden)]
32+
/// The transform prelude.
33+
///
34+
/// This includes the most common types in this crate, re-exported for your convenience.
3335
pub mod prelude {
3436
#[doc(hidden)]
3537
pub use crate::components::*;

crates/bevy_ui/src/lib.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,9 @@ pub use ui_material::*;
4040
pub use ui_node::*;
4141
use widget::UiImageSize;
4242

43-
#[doc(hidden)]
43+
/// The UI prelude.
44+
///
45+
/// This includes the most common types in this crate, re-exported for your convenience.
4446
pub mod prelude {
4547
#[doc(hidden)]
4648
pub use crate::{

crates/bevy_utils/src/lib.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@
1010
//! [Bevy]: https://bevyengine.org/
1111
//!
1212
13-
#[allow(missing_docs)]
13+
/// The utilities prelude.
14+
///
15+
/// This includes the most common types in this crate, re-exported for your convenience.
1416
pub mod prelude {
1517
pub use crate::default;
1618
}

crates/bevy_window/src/lib.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ pub use system::*;
3030
pub use system_cursor::*;
3131
pub use window::*;
3232

33-
#[allow(missing_docs)]
33+
/// The windowing prelude.
34+
///
35+
/// This includes the most common types in this crate, re-exported for your convenience.
3436
pub mod prelude {
3537
#[allow(deprecated)]
3638
#[doc(hidden)]

0 commit comments

Comments
 (0)