mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-23 07:14:28 +00:00
Make invalid_html_tags lint only run on nightly and being allowed by default
This commit is contained in:
parent
6271a0a46d
commit
f9a65afb27
@ -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"
|
||||
}
|
||||
|
||||
|
@ -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() {}
|
||||
|
@ -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] = &[
|
||||
|
Loading…
Reference in New Issue
Block a user