Skip to content

Commit 88b070a

Browse files
Return early in check_custom_code_classes check if the feature is enabled
1 parent 494fdcd commit 88b070a

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/librustdoc/passes/check_custom_code_classes.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ pub(crate) const CHECK_CUSTOM_CODE_CLASSES: Pass = Pass {
2121
};
2222

2323
pub(crate) fn check_custom_code_classes(krate: Crate, cx: &mut DocContext<'_>) -> Crate {
24+
if cx.tcx.features().custom_code_classes_in_docs {
25+
// Nothing to check here if the feature is enabled.
26+
return krate;
27+
}
2428
let mut coll = CustomCodeClassLinter { cx };
2529

2630
coll.fold_crate(krate)
@@ -59,7 +63,7 @@ pub(crate) fn look_for_custom_classes<'tcx>(cx: &DocContext<'tcx>, item: &Item)
5963
let dox = item.attrs.doc_value();
6064
find_codes(&dox, &mut tests, ErrorCodes::No, false, None, true, true);
6165

62-
if !tests.custom_classes_found.is_empty() && !cx.tcx.features().custom_code_classes_in_docs {
66+
if !tests.custom_classes_found.is_empty() {
6367
let span = item.attr_span(cx.tcx);
6468
let sess = &cx.tcx.sess.parse_sess;
6569
let mut err = sess

0 commit comments

Comments
 (0)