diff --git a/src/librustdoc/lint.rs b/src/librustdoc/lint.rs index 778983868ea01..013b7ead5c7c9 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" }