From f066be7e1ed36e173edaf008c695420112966c8f Mon Sep 17 00:00:00 2001 From: lucarlig Date: Sun, 25 Feb 2024 21:31:46 +0400 Subject: [PATCH] use span of fragments --- clippy_lints/src/doc/empty_docs.rs | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/clippy_lints/src/doc/empty_docs.rs b/clippy_lints/src/doc/empty_docs.rs index b0be71139616..84cbc3207f34 100644 --- a/clippy_lints/src/doc/empty_docs.rs +++ b/clippy_lints/src/doc/empty_docs.rs @@ -1,17 +1,13 @@ +use super::EMPTY_DOCS; use clippy_utils::diagnostics::span_lint_and_help; use rustc_ast::Attribute; use rustc_lint::LateContext; - -use super::EMPTY_DOCS; +use rustc_resolve::rustdoc::{attrs_to_doc_fragments, span_of_fragments}; // TODO: Adjust the parameters as necessary pub(super) fn check(cx: &LateContext<'_>, attrs: &[Attribute]) { - let doc_attrs: Vec<_> = attrs.iter().filter(|attr| attr.doc_str().is_some()).collect(); - let span; - if let Some(first) = doc_attrs.first() - && let Some(last) = doc_attrs.last() - { - span = first.span.with_hi(last.span.hi()); + let (fragments, _) = attrs_to_doc_fragments(attrs.iter().map(|attr| (attr, None)), true); + if let Some(span) = span_of_fragments(&fragments) { span_lint_and_help( cx, EMPTY_DOCS,