about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorJoshua Nelson <jyn514@gmail.com>2020-12-30 14:17:18 -0500
committerJoshua Nelson <jyn514@gmail.com>2021-03-01 19:29:15 -0500
commit719535576738ee97a866ce7fbf76a42d6399627b (patch)
tree300d4a1a9cfc73ec7a059e489dce9d9503fbd373 /src
parent37e4cfe5125e1d8d29fd1a66c7f80109c25618fb (diff)
downloadrust-719535576738ee97a866ce7fbf76a42d6399627b.tar.gz
rust-719535576738ee97a866ce7fbf76a42d6399627b.zip
Add `declare_rustdoc_lint!` macro
Diffstat (limited to 'src')
-rw-r--r--src/librustdoc/lint.rs36
1 files changed, 22 insertions, 14 deletions
diff --git a/src/librustdoc/lint.rs b/src/librustdoc/lint.rs
index 778983868ea..013b7ead5c7 100644
--- a/src/librustdoc/lint.rs
+++ b/src/librustdoc/lint.rs
@@ -63,78 +63,86 @@ where
     (lint_opts, lint_caps)
 }
 
-declare_tool_lint! {
+macro_rules! declare_rustdoc_lint {
+    ($(#[$attr:meta])* $name: ident, $level: ident, $descr: literal $(,)?) => {
+        declare_tool_lint! {
+            $(#[$attr])* pub rustdoc::$name, $level, $descr
+        }
+    }
+}
+
+declare_rustdoc_lint! {
     /// The `broken_intra_doc_links` lint detects failures in resolving
     /// intra-doc link targets. This is a `rustdoc` only lint, see the
     /// documentation in the [rustdoc book].
     ///
     /// [rustdoc book]: ../../../rustdoc/lints.html#broken_intra_doc_links
-    pub rustdoc::BROKEN_INTRA_DOC_LINKS,
+    BROKEN_INTRA_DOC_LINKS,
     Warn,
     "failures in resolving intra-doc link targets"
 }
 
-declare_tool_lint! {
+declare_rustdoc_lint! {
     /// This is a subset of `broken_intra_doc_links` that warns when linking from
     /// a public item to a private one. This is a `rustdoc` only lint, see the
     /// documentation in the [rustdoc book].
     ///
     /// [rustdoc book]: ../../../rustdoc/lints.html#private_intra_doc_links
-    pub rustdoc::PRIVATE_INTRA_DOC_LINKS,
+    PRIVATE_INTRA_DOC_LINKS,
     Warn,
     "linking from a public item to a private one"
 }
 
-declare_tool_lint! {
+declare_rustdoc_lint! {
     /// The `invalid_codeblock_attributes` lint detects code block attributes
     /// in documentation examples that have potentially mis-typed values. This
     /// is a `rustdoc` only lint, see the documentation in the [rustdoc book].
     ///
     /// [rustdoc book]: ../../../rustdoc/lints.html#invalid_codeblock_attributes
-    pub rustdoc::INVALID_CODEBLOCK_ATTRIBUTES,
+    INVALID_CODEBLOCK_ATTRIBUTES,
     Warn,
     "codeblock attribute looks a lot like a known one"
 }
 
-declare_tool_lint! {
+declare_rustdoc_lint! {
     /// The `missing_doc_code_examples` lint detects publicly-exported items
     /// without code samples in their documentation. This is a `rustdoc` only
     /// lint, see the documentation in the [rustdoc book].
     ///
     /// [rustdoc book]: ../../../rustdoc/lints.html#missing_doc_code_examples
-    pub rustdoc::MISSING_DOC_CODE_EXAMPLES,
+    MISSING_DOC_CODE_EXAMPLES,
     Allow,
     "detects publicly-exported items without code samples in their documentation"
 }
 
-declare_tool_lint! {
+declare_rustdoc_lint! {
     /// The `private_doc_tests` lint detects code samples in docs of private
     /// items not documented by `rustdoc`. This is a `rustdoc` only lint, see
     /// the documentation in the [rustdoc book].
     ///
     /// [rustdoc book]: ../../../rustdoc/lints.html#private_doc_tests
-    pub rustdoc::PRIVATE_DOC_TESTS,
+    PRIVATE_DOC_TESTS,
     Allow,
     "detects code samples in docs of private items not documented by rustdoc"
 }
 
-declare_tool_lint! {
+declare_rustdoc_lint! {
     /// The `invalid_html_tags` lint detects invalid HTML tags. This is a
     /// `rustdoc` only lint, see the documentation in the [rustdoc book].
     ///
     /// [rustdoc book]: ../../../rustdoc/lints.html#invalid_html_tags
-    pub rustdoc::INVALID_HTML_TAGS,
+    INVALID_HTML_TAGS,
     Allow,
     "detects invalid HTML tags in doc comments"
 }
 
-declare_tool_lint! {
+declare_rustdoc_lint! {
     /// The `non_autolinks` lint detects when a URL could be written using
     /// only angle brackets. This is a `rustdoc` only lint, see the
     /// documentation in the [rustdoc book].
     ///
     /// [rustdoc book]: ../../../rustdoc/lints.html#non_autolinks
-    pub rustdoc::NON_AUTOLINKS,
+    NON_AUTOLINKS,
     Warn,
     "detects URLs that could be written using only angle brackets"
 }