Skip to content

Commit 5152050

Browse files
committed
move lint directly into check_attrs
1 parent ee50d5d commit 5152050

File tree

2 files changed

+12
-23
lines changed

2 files changed

+12
-23
lines changed

clippy_lints/src/doc/empty_docs.rs

-20
This file was deleted.

clippy_lints/src/doc/mod.rs

+12-3
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@ use rustc_middle::hir::nested_filter;
1919
use rustc_middle::lint::in_external_macro;
2020
use rustc_middle::ty::{self};
2121
use rustc_resolve::rustdoc::{
22-
add_doc_fragment, attrs_to_doc_fragments, main_body_opts, source_span_for_markdown_range, DocFragment,
22+
add_doc_fragment, attrs_to_doc_fragments, main_body_opts, source_span_for_markdown_range, span_of_fragments,
23+
DocFragment,
2324
};
2425
use rustc_session::impl_lint_pass;
2526
use rustc_span::edition::Edition;
2627
use rustc_span::{sym, Span};
2728
use std::ops::Range;
2829
use url::Url;
2930

30-
mod empty_docs;
3131
mod link_with_quotes;
3232
mod markdown;
3333
mod missing_headers;
@@ -546,7 +546,16 @@ fn check_attrs(cx: &LateContext<'_>, valid_idents: &FxHashSet<String>, attrs: &[
546546
doc.pop();
547547

548548
if doc.trim().is_empty() {
549-
empty_docs::check(cx, attrs);
549+
if let Some(span) = span_of_fragments(&fragments) {
550+
span_lint_and_help(
551+
cx,
552+
EMPTY_DOCS,
553+
span,
554+
"empty doc comment",
555+
None,
556+
"consider removing or filling it",
557+
);
558+
}
550559
return Some(DocHeaders::default());
551560
}
552561

0 commit comments

Comments
 (0)