From 2857e22024536e9b006d06f5e79a2e388a1ed1fa Mon Sep 17 00:00:00 2001 From: ObserverOfTime Date: Wed, 11 Sep 2024 17:21:34 +0300 Subject: [PATCH] docs(rust): properly document optional feature part 2 --- Cargo.toml | 1 + bindings/rust/lib.rs | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/Cargo.toml b/Cargo.toml index 9d37bec..bf00c40 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -50,3 +50,4 @@ debug = true [package.metadata.docs.rs] features = ["parser"] +rustdoc-args = ["--cfg", "docsrs"] diff --git a/bindings/rust/lib.rs b/bindings/rust/lib.rs index 206ead4..8dcd10e 100644 --- a/bindings/rust/lib.rs +++ b/bindings/rust/lib.rs @@ -12,6 +12,8 @@ //! [Tree]: https://docs.rs/tree-sitter/*/tree_sitter/struct.Tree.html //! [tree-sitter]: https://tree-sitter.github.io/ +#![cfg_attr(docsrs, feature(doc_cfg))] + use tree_sitter_language::LanguageFn; extern "C" { @@ -54,9 +56,11 @@ pub const NODE_TYPES_INLINE: &str = include_str!("../../tree-sitter-markdown-inline/src/node-types.json"); #[cfg(feature = "parser")] +#[cfg_attr(docsrs, doc(cfg(feature = "parser")))] mod parser; #[cfg(feature = "parser")] +#[cfg_attr(docsrs, doc(cfg(feature = "parser")))] pub use parser::*; #[cfg(test)]