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
|
/// [rustdoc book]: ../../../rustdoc/lints.html#invalid_html_tags
|
||||||
pub INVALID_HTML_TAGS,
|
pub INVALID_HTML_TAGS,
|
||||||
Warn,
|
Allow,
|
||||||
"detects invalid HTML tags in doc comments"
|
"detects invalid HTML tags in doc comments"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -253,10 +253,12 @@ typo mistakes for some common attributes.
|
|||||||
|
|
||||||
## invalid_html_tags
|
## invalid_html_tags
|
||||||
|
|
||||||
This lint **warns by default**. It detects unclosed or invalid HTML tags.
|
This lint is **allowed by default** and is **nightly-only**. It detects unclosed
|
||||||
For example:
|
or invalid HTML tags. For example:
|
||||||
|
|
||||||
```rust
|
```rust
|
||||||
|
#![warn(invalid_html_tags)]
|
||||||
|
|
||||||
/// <h1>
|
/// <h1>
|
||||||
/// </script>
|
/// </script>
|
||||||
pub fn foo() {}
|
pub fn foo() {}
|
||||||
|
@ -5,9 +5,8 @@ use crate::fold::DocFolder;
|
|||||||
use crate::html::markdown::opts;
|
use crate::html::markdown::opts;
|
||||||
use core::ops::Range;
|
use core::ops::Range;
|
||||||
use pulldown_cmark::{Event, Parser};
|
use pulldown_cmark::{Event, Parser};
|
||||||
// use rustc_hir::hir_id::HirId;
|
use rustc_feature::UnstableFeatures;
|
||||||
use rustc_session::lint;
|
use rustc_session::lint;
|
||||||
// use rustc_span::Span;
|
|
||||||
|
|
||||||
pub const CHECK_INVALID_HTML_TAGS: Pass = Pass {
|
pub const CHECK_INVALID_HTML_TAGS: Pass = Pass {
|
||||||
name: "check-invalid-html-tags",
|
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 {
|
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] = &[
|
const ALLOWED_UNCLOSED: &[&str] = &[
|
||||||
|
Loading…
x
Reference in New Issue
Block a user