Skip to content

Commit a0e6bdc

Browse files
authored
Merge pull request #4984 from epage/ref
docs(derive): Ensure magic attributes are searchable
2 parents c94ae5f + ffbe6e9 commit a0e6bdc

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

clap_derive/CONTRIBUTING.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,5 @@ See the [clap-wide CONTRIBUTING.md](../CONTRIBUTING.md). This will contain `cla
99
- Prefer substituting variable names to avoid problems with `macro_rules`, see [#2823](https://github.com/clap-rs/clap/pull/2823).
1010
- Prefer `::std::result::Result` and `::std::option::Option`, see [#3092](https://github.com/clap-rs/clap/pull/3092).
1111
- Put whitespace between `#quoted #variables`.
12+
- New "magic" attributes must be documented in the [derive reference](../src/_derive.rs)
13+
- If there is no related builder method, a `#![doc(alias = "")]` should also be added, see [#4984](https://github.com/clap-rs/clap/pull/4984)

src/_derive/mod.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -485,6 +485,20 @@
485485
//! ([example][_tutorial#testing])
486486
//! - Always remember to [document](#doc-comments) args and commands with `#![deny(missing_docs)]`
487487
488+
// Point people here that search for attributes that don't exist in the derive (a subset of magic
489+
// attributes)
490+
#![doc(alias = "skip")]
491+
#![doc(alias = "verbatim_doc_comment")]
492+
#![doc(alias = "flatten")]
493+
#![doc(alias = "external_subcommand")]
494+
#![doc(alias = "subcommand")]
495+
#![doc(alias = "rename_all")]
496+
#![doc(alias = "rename_all_env")]
497+
#![doc(alias = "default_value_t")]
498+
#![doc(alias = "default_values_t")]
499+
#![doc(alias = "default_value_os_t")]
500+
#![doc(alias = "default_values_os_t")]
501+
488502
pub mod _tutorial;
489503
#[doc(inline)]
490504
pub use crate::_cookbook;

0 commit comments

Comments
 (0)