Rollup merge of #89444 - notriddle:notriddle/contains-str, r=jyn514

rustdoc: use slice::contains instead of open-coding it
This commit is contained in:
Jubilee 2021-10-04 13:58:12 -07:00 committed by GitHub
commit b115a16956
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -52,7 +52,7 @@ fn drop_tag(
continue;
}
let last_tag_name_low = last_tag_name.to_lowercase();
if ALLOWED_UNCLOSED.iter().any(|&at| at == last_tag_name_low) {
if ALLOWED_UNCLOSED.contains(&last_tag_name_low.as_str()) {
continue;
}
// `tags` is used as a queue, meaning that everything after `pos` is included inside it.
@ -207,7 +207,7 @@ impl<'a, 'tcx> DocFolder for InvalidHtmlTagsLinter<'a, 'tcx> {
for (tag, range) in tags.iter().filter(|(t, _)| {
let t = t.to_lowercase();
ALLOWED_UNCLOSED.iter().find(|&&at| at == t).is_none()
!ALLOWED_UNCLOSED.contains(&t.as_str())
}) {
report_diag(&format!("unclosed HTML tag `{}`", tag), range);
}