From ffbe6e993678f059f92d1fedbc4171fc03bc753e Mon Sep 17 00:00:00 2001 From: Ed Page Date: Fri, 23 Jun 2023 13:20:21 -0500 Subject: [PATCH] docs(derive): Ensure magic attributes are searchable --- clap_derive/CONTRIBUTING.md | 2 ++ src/_derive/mod.rs | 14 ++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/clap_derive/CONTRIBUTING.md b/clap_derive/CONTRIBUTING.md index 26d5f5ee892..33197199502 100644 --- a/clap_derive/CONTRIBUTING.md +++ b/clap_derive/CONTRIBUTING.md @@ -9,3 +9,5 @@ See the [clap-wide CONTRIBUTING.md](../CONTRIBUTING.md). This will contain `cla - Prefer substituting variable names to avoid problems with `macro_rules`, see [#2823](https://github.com/clap-rs/clap/pull/2823). - Prefer `::std::result::Result` and `::std::option::Option`, see [#3092](https://github.com/clap-rs/clap/pull/3092). - Put whitespace between `#quoted #variables`. +- New "magic" attributes must be documented in the [derive reference](../src/_derive.rs) + - If there is no related builder method, a `#![doc(alias = "")]` should also be added, see [#4984](https://github.com/clap-rs/clap/pull/4984) diff --git a/src/_derive/mod.rs b/src/_derive/mod.rs index d2bad065269..0c479a23696 100644 --- a/src/_derive/mod.rs +++ b/src/_derive/mod.rs @@ -485,6 +485,20 @@ //! ([example][_tutorial#testing]) //! - Always remember to [document](#doc-comments) args and commands with `#![deny(missing_docs)]` +// Point people here that search for attributes that don't exist in the derive (a subset of magic +// attributes) +#![doc(alias = "skip")] +#![doc(alias = "verbatim_doc_comment")] +#![doc(alias = "flatten")] +#![doc(alias = "external_subcommand")] +#![doc(alias = "subcommand")] +#![doc(alias = "rename_all")] +#![doc(alias = "rename_all_env")] +#![doc(alias = "default_value_t")] +#![doc(alias = "default_values_t")] +#![doc(alias = "default_value_os_t")] +#![doc(alias = "default_values_os_t")] + pub mod _tutorial; #[doc(inline)] pub use crate::_cookbook;