deny(missing_docs) for bevy_ecs_macros (#19523)

# Objective

Deny missing docs for bevy_ecs_macros, towards
https://github.com/bevyengine/bevy/issues/3492.

## Solution

More docs of the form

```
/// Does the thing
fn do_the_thing() {}
```

But I don't think the derive macros are where anyone is going to be
looking for details of these concepts and deny(missing_docs) inevitably
results in some items having noddy docs.
This commit is contained in:
theotherphil 2025-06-08 17:28:31 +01:00 committed by GitHub
parent a16adc751b
commit 6b5289bd5e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,4 +1,5 @@
#![expect(missing_docs, reason = "Not all docs are written yet, see #3492.")] //! Macros for deriving ECS traits.
#![cfg_attr(docsrs, feature(doc_auto_cfg))] #![cfg_attr(docsrs, feature(doc_auto_cfg))]
extern crate proc_macro; extern crate proc_macro;
@ -29,6 +30,7 @@ enum BundleFieldKind {
const BUNDLE_ATTRIBUTE_NAME: &str = "bundle"; const BUNDLE_ATTRIBUTE_NAME: &str = "bundle";
const BUNDLE_ATTRIBUTE_IGNORE_NAME: &str = "ignore"; const BUNDLE_ATTRIBUTE_IGNORE_NAME: &str = "ignore";
/// Implement the `Bundle` trait.
#[proc_macro_derive(Bundle, attributes(bundle))] #[proc_macro_derive(Bundle, attributes(bundle))]
pub fn derive_bundle(input: TokenStream) -> TokenStream { pub fn derive_bundle(input: TokenStream) -> TokenStream {
let ast = parse_macro_input!(input as DeriveInput); let ast = parse_macro_input!(input as DeriveInput);
@ -187,6 +189,7 @@ pub fn derive_bundle(input: TokenStream) -> TokenStream {
}) })
} }
/// Implement the `MapEntities` trait.
#[proc_macro_derive(MapEntities, attributes(entities))] #[proc_macro_derive(MapEntities, attributes(entities))]
pub fn derive_map_entities(input: TokenStream) -> TokenStream { pub fn derive_map_entities(input: TokenStream) -> TokenStream {
let ast = parse_macro_input!(input as DeriveInput); let ast = parse_macro_input!(input as DeriveInput);
@ -522,16 +525,19 @@ pub(crate) fn bevy_ecs_path() -> syn::Path {
BevyManifest::shared().get_path("bevy_ecs") BevyManifest::shared().get_path("bevy_ecs")
} }
/// Implement the `Event` trait.
#[proc_macro_derive(Event, attributes(event))] #[proc_macro_derive(Event, attributes(event))]
pub fn derive_event(input: TokenStream) -> TokenStream { pub fn derive_event(input: TokenStream) -> TokenStream {
component::derive_event(input) component::derive_event(input)
} }
/// Implement the `Resource` trait.
#[proc_macro_derive(Resource)] #[proc_macro_derive(Resource)]
pub fn derive_resource(input: TokenStream) -> TokenStream { pub fn derive_resource(input: TokenStream) -> TokenStream {
component::derive_resource(input) component::derive_resource(input)
} }
/// Implement the `Component` trait.
#[proc_macro_derive( #[proc_macro_derive(
Component, Component,
attributes(component, require, relationship, relationship_target, entities) attributes(component, require, relationship, relationship_target, entities)
@ -540,6 +546,7 @@ pub fn derive_component(input: TokenStream) -> TokenStream {
component::derive_component(input) component::derive_component(input)
} }
/// Implement the `FromWorld` trait.
#[proc_macro_derive(FromWorld, attributes(from_world))] #[proc_macro_derive(FromWorld, attributes(from_world))]
pub fn derive_from_world(input: TokenStream) -> TokenStream { pub fn derive_from_world(input: TokenStream) -> TokenStream {
let bevy_ecs_path = bevy_ecs_path(); let bevy_ecs_path = bevy_ecs_path();