Files
Doonv 16f622c739 Fix docs.rs extensions README providing invalid Cargo.toml snippet (#23578)
# Objective

The README in `docs-rs/` tells you to add this line to your
`Cargo.toml`:
```toml
[lints.rust]
unexpected_cfgs = { check-cfg = ['cfg(docsrs_dep)'] }
```

However this does not compile due to this error:
```
error: missing field `level`
  --> Cargo.toml:41:19
   |
41 | unexpected_cfgs = { check-cfg = ['cfg(docsrs_dep)'] }
   |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
```

## Solution

Looking at Bevy's own `Cargo.toml`, this lint is used with the `warn`
level.
```toml
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(docsrs_dep)'] }
```

So I updated the docs.rs README to be the same.

## Testing

I copied and pasted the new snippet into my `Cargo.toml` and it worked.
2026-03-30 21:18:45 +00:00

953 B

Docs.rs Extensions

This directory includes some templates and styling to extend and modify rustdoc's output for Bevy's documentation on docs.rs. Currently this consists of tags indicating core bevy_ecs traits.

3rd Party Crates

To use in your own crate, first copy this folder into your project, then add the following to your Cargo.toml:

[package.metadata.docs.rs]
rustc-args = ["--cfg", "docsrs_dep"]
rustdoc-args = [
    "--cfg", "docsrs_dep",
    "--html-after-content", "docs-rs/trait-tags.html",
]

[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(docsrs_dep)'] }

Local Testing

Build the documentation with the extension enabled like this:

RUSTDOCFLAGS="--html-after-content docs-rs/trait-tags.html --cfg docsrs_dep" RUSTFLAGS="--cfg docsrs_dep" cargo doc --no-deps --package <package_name>