From 41197bf515c59e9723a894abb43e1a3d0d8aa461 Mon Sep 17 00:00:00 2001 From: Maybe Waffle Date: Sun, 3 Jul 2022 14:33:46 +0400 Subject: [PATCH] Change recommended way to build docs Former-commit-id: a4ad44fae96b8bf5858d673ff875fb7a46d4e126 --- .cargo/config.toml | 12 ++++++++++++ src/lib.rs | 8 ++------ 2 files changed, 14 insertions(+), 6 deletions(-) create mode 100644 .cargo/config.toml diff --git a/.cargo/config.toml b/.cargo/config.toml new file mode 100644 index 00000000..d6e070ff --- /dev/null +++ b/.cargo/config.toml @@ -0,0 +1,12 @@ +[alias] +# We pass "--cfg docsrs" when building docs to turn on nightly-only rustdoc features like +# `This is supported on feature="..." only.` +# +# "--cfg dep_docsrs" is used for the same reason, but for `teloxide-core`. +docs = """ +doc + --all-features + --config build.rustflags=["--cfg=dep_docsrs"] + --config build.rustdocflags=["--cfg=docsrs","-Znormalize-docs"] + -Zrustdoc-scrape-examples=examples +""" diff --git a/src/lib.rs b/src/lib.rs index f53ed5c5..e43af26c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -44,15 +44,11 @@ html_logo_url = "https://github.com/teloxide/teloxide/raw/master/ICON.png", html_favicon_url = "https://github.com/teloxide/teloxide/raw/master/ICON.png" )] -// We pass "--cfg docsrs" when building docs to add `This is supported on -// feature="..." only.` -// -// "--cfg dep_docsrs" is used for the same reason, but for `teloxide-core`. -// // To properly build docs of this crate run // ```console -// $ RUSTFLAGS="--cfg dep_docsrs" RUSTDOCFLAGS="--cfg docsrs -Znormalize-docs" cargo +nightly doc --open --all-features +// $ cargo docs --open // ``` +// (docs is an alias from `.cargo/config.toml`) #![cfg_attr(all(docsrs, feature = "nightly"), feature(doc_cfg, doc_auto_cfg))] #![forbid(unsafe_code)] #![warn(rustdoc::broken_intra_doc_links)]