From e67a061bcf567c6518d6c2f58852e01f02764b22 Mon Sep 17 00:00:00 2001 From: Martin Geisler Date: Sat, 23 Sep 2017 12:48:23 +0200 Subject: [PATCH] docs: add html_root_url attribute This doc attribute is used by rustdoc when generating documentation for other crates that depend on this crate. With the html_root_url, rustdoc will be able to generate correct links into this crate. See C-HTML-ROOT in the Rust API Guidelines for more information: https://rust-lang-nursery.github.io/api-guidelines/documentation.html#crate-sets-html_root_url-attribute-c-html-root A version-sync check was added to ensure that the URL is kept up to date when the crate version changes. --- src/lib.rs | 1 + tests/version-numbers.rs | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index 468dd5967e8..cadee3afb99 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -511,6 +511,7 @@ //! this repository for more information. #![crate_type= "lib"] +#![doc(html_root_url = "https://docs.rs/clap/2.26.2")] #![deny( missing_docs, missing_debug_implementations, diff --git a/tests/version-numbers.rs b/tests/version-numbers.rs index 0ed38388a09..411eea548ea 100644 --- a/tests/version-numbers.rs +++ b/tests/version-numbers.rs @@ -5,3 +5,8 @@ extern crate version_sync; fn test_readme_deps() { assert_markdown_deps_updated!("README.md"); } + +#[test] +fn test_html_root_url() { + assert_html_root_url_updated!("src/lib.rs"); +}