Make invalid_html_tags lint only run on nightly and being allowed by default

This commit is contained in:
Guillaume Gomez 2020-09-25 14:04:10 +02:00
parent 6271a0a46d
commit f9a65afb27
3 changed files with 12 additions and 7 deletions

View File

@ -1887,7 +1887,7 @@ declare_lint! {
///
/// [rustdoc book]: ../../../rustdoc/lints.html#invalid_html_tags
pub INVALID_HTML_TAGS,
Warn,
Allow,
"detects invalid HTML tags in doc comments"
}

View File

@ -253,10 +253,12 @@ typo mistakes for some common attributes.
## invalid_html_tags
This lint **warns by default**. It detects unclosed or invalid HTML tags.
For example:
This lint is **allowed by default** and is **nightly-only**. It detects unclosed
or invalid HTML tags. For example:
```rust
#![warn(invalid_html_tags)]
/// <h1>
/// </script>
pub fn foo() {}

View File

@ -5,9 +5,8 @@ use crate::fold::DocFolder;
use crate::html::markdown::opts;
use core::ops::Range;
use pulldown_cmark::{Event, Parser};
// use rustc_hir::hir_id::HirId;
use rustc_feature::UnstableFeatures;
use rustc_session::lint;
// use rustc_span::Span;
pub const CHECK_INVALID_HTML_TAGS: Pass = Pass {
name: "check-invalid-html-tags",
@ -26,9 +25,13 @@ impl<'a, 'tcx> InvalidHtmlTagsLinter<'a, 'tcx> {
}
pub fn check_invalid_html_tags(krate: Crate, cx: &DocContext<'_>) -> Crate {
let mut coll = InvalidHtmlTagsLinter::new(cx);
if !UnstableFeatures::from_environment().is_nightly_build() {
krate
} else {
let mut coll = InvalidHtmlTagsLinter::new(cx);
coll.fold_crate(krate)
coll.fold_crate(krate)
}
}
const ALLOWED_UNCLOSED: &[&str] = &[