bevy/crates/bevy_encase_derive/src/lib.rs
Ame 72c51cdab9
Make feature(doc_auto_cfg) work (#12642)
# Objective

- In #12366 `![cfg_attr(docsrs, feature(doc_auto_cfg))] `was added. But
to apply it it needs `--cfg=docsrs` in rustdoc-args.


## Solution

- Apply `--cfg=docsrs` to all crates and CI.

I also added `[package.metadata.docs.rs]` to all crates to avoid adding
code behind a feature and forget adding the metadata.

Before:

![Screenshot 2024-03-22 at 00 51
57](https://github.com/bevyengine/bevy/assets/104745335/6a9dfdaa-8710-4784-852b-5f9b74e3522c)

After:
![Screenshot 2024-03-22 at 00 51
32](https://github.com/bevyengine/bevy/assets/104745335/c5bd6d8e-8ddb-45b3-b844-5ecf9f88961c)
2024-03-23 02:22:52 +00:00

33 lines
968 B
Rust

// FIXME(3492): remove once docs are ready
#![allow(missing_docs)]
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
use bevy_macro_utils::BevyManifest;
use encase_derive_impl::{implement, syn};
const ENCASE: &str = "encase";
fn bevy_encase_path() -> syn::Path {
let bevy_manifest = BevyManifest::default();
bevy_manifest
.get_subcrate("render")
.map(|bevy_render_path| {
let mut segments = bevy_render_path.segments;
segments.push(BevyManifest::parse_str("render_resource"));
syn::Path {
leading_colon: None,
segments,
}
})
.map(|path| {
let mut segments = path.segments;
segments.push(BevyManifest::parse_str(ENCASE));
syn::Path {
leading_colon: None,
segments,
}
})
.unwrap_or_else(|| bevy_manifest.get_path(ENCASE))
}
implement!(bevy_encase_path());