Skip to content

Commit f066be7

Browse files
committed
use span of fragments
1 parent d7ad85f commit f066be7

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

clippy_lints/src/doc/empty_docs.rs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,13 @@
1+
use super::EMPTY_DOCS;
12
use clippy_utils::diagnostics::span_lint_and_help;
23
use rustc_ast::Attribute;
34
use rustc_lint::LateContext;
4-
5-
use super::EMPTY_DOCS;
5+
use rustc_resolve::rustdoc::{attrs_to_doc_fragments, span_of_fragments};
66

77
// TODO: Adjust the parameters as necessary
88
pub(super) fn check(cx: &LateContext<'_>, attrs: &[Attribute]) {
9-
let doc_attrs: Vec<_> = attrs.iter().filter(|attr| attr.doc_str().is_some()).collect();
10-
let span;
11-
if let Some(first) = doc_attrs.first()
12-
&& let Some(last) = doc_attrs.last()
13-
{
14-
span = first.span.with_hi(last.span.hi());
9+
let (fragments, _) = attrs_to_doc_fragments(attrs.iter().map(|attr| (attr, None)), true);
10+
if let Some(span) = span_of_fragments(&fragments) {
1511
span_lint_and_help(
1612
cx,
1713
EMPTY_DOCS,

0 commit comments

Comments
 (0)